1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/15538] Revert back to Icon function

PHPBB3-15538
This commit is contained in:
mrgoldy
2019-10-04 12:58:39 +02:00
committed by Marc Alexander
parent 341266cc71
commit ba5e73bfea
9 changed files with 17 additions and 435 deletions

View File

@@ -1,34 +0,0 @@
{# Wrapper function #}
{% macro Icon(type, icon, classes = '', title = '', hidden = false, attributes = {}) %}
{% set type = type|capitalize %}
{% if type in ['Fa', 'Png', 'Svg'] %}
{{ attribute(_self, type, [icon, classes, title, hidden, attributes]) }}
{% endif %}
{% endmacro Icon %}
{# FA icons #}
{% macro Fa(icon, classes = '', title = '', hidden = false, attributes = {}) %}
<i class="o-icon font fa-{{ icon ~ Implode_classes(classes) }}"{% if hidden %}{% if title %} title="{{ lang(title) }}"{% endif %} aria-hidden="true"{% endif %}{{ Implode_attributes(attributes) }}></i>
{% if title %}<span{% if hidden %} class="sr-only"{% endif %}>{{ lang(title) }}</span>{% endif %}
{% endmacro Fa %}
{# PNG icons #}
{% macro Png(icon, classes = '', title = '', hidden = false, attributes = {}) %}
<img class="o-icon png png-{{ icon ~ Implode_classes(classes) }}" src="{{ icon|png_path }}" alt="{{ lang(title) }}"{{ _self.attributes(attributes) }}
{% endmacro Png %}
{# SVG icons #}
{% macro Svg(icon, classes = '', title = '', hidden = false, attributes = {}) %}
{% set title_id = title ? title|lower|replace({' ': '_'}) ~ '-' ~ random() %}
<svg class="o-icon svg svg-{{ icon ~ Implode_classes(classes) }}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"{% if title %}{% if hidden %} aria-hidden="true"{% endif %} aria-labelledby="{{ title_id }}"{% endif %} role="img"{{ Implode_attributes(attributes) }}>
{% if title %}
<title id="{{ title_id }}">{{ lang(title) }}</title>
{% endif %}
{{ Svg_clean(icon) }}
</svg>
{% endmacro Svg %}
{% from _self import Icon as Icon %}

View File

@@ -0,0 +1,4 @@
{% spaceless %}
<i class="o-icon font fa-{{ ICON ~ (CLASSES ? ' ' ~ CLASSES) }}"{% if S_HIDDEN %}{% if TITLE %} title="{{ lang(TITLE) }}"{% endif %} aria-hidden="true"{% endif %}{{ ATTRIBUTES }}></i>
{% if TITLE %}<span{% if S_HIDDEN %} class="sr-only"{% endif %}>{{ lang(TITLE) }}</span>{% endif %}
{% endspaceless %}

View File

@@ -0,0 +1,3 @@
{% spaceless %}
<img class="o-icon png png-{{ ICON ~ (CLASSES ? ' ' ~ CLASSES) }}" src="{{ SOURCE }}" alt="{{ lang(TITLE) }}"{{ ATTRIBUTES }} />
{% endspaceless %}

View File

@@ -0,0 +1,9 @@
{% spaceless %}
{% set TITLE_ID = TITLE ? TITLE|lower|replace({' ': '_'}) ~ '-' ~ random() %}
<svg class="o-icon svg svg-{{ ICON ~ (CLASSES ? ' ' ~ CLASSES) }}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"{% if TITLE %}{% if S_HIDDEN %} aria-hidden="true"{% endif %} aria-labelledby="{{ TITLE_ID }}"{% endif %} role="img"{{ ATTRIBUTES }}>
{% if TITLE %}<title id="{{ TITLE_ID }}">{{ lang(TITLE) }}</title>{% endif %}
{{ SOURCE }}
</svg>
{% endspaceless %}

View File

@@ -11,8 +11,6 @@
<!-- ENDIF -->
<!-- EVENT index_body_markforums_after -->
Test: {{ macros.Icon('fa', 'phone') }}
<!-- INCLUDE forumlist_body.html -->
<!-- EVENT index_body_forumlist_body_after -->
@@ -43,7 +41,7 @@ Test: {{ macros.Icon('fa', 'phone') }}
<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
<p>
<!-- EVENT index_body_block_online_prepend -->
{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br />
{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br />
<!-- IF U_VIEWONLINE -->
<br />{LOGGED_IN_USER_LIST}
<!-- IF LEGEND --><br /><em>{L_LEGEND}{L_COLON} {LEGEND}</em><!-- ENDIF -->