1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-05 08:23:28 +02:00

[ticket/15538] Add iconify source class

PHPBB3-15538
This commit is contained in:
mrgoldy 2019-11-18 17:22:12 +01:00
parent fa8cf86e63
commit 8bac1daba7
3 changed files with 14 additions and 5 deletions

View File

@ -69,13 +69,22 @@ class icon extends \Twig\Extension\AbstractExtension
{
$type = strtolower($type);
if (empty($icon))
{
return '';
}
switch ($type)
{
case 'font':
case 'iconify':
$source = '';
break;
case 'iconify':
$source = explode(':', $icon);
$source = $source[0];
break;
case 'png':
$board_url = defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH;
$web_path = $board_url ? generate_board_url() . '/' : $environment->get_web_root_path();

View File

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

View File

@ -313,7 +313,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
'attributes' => [],
],
[],
'<i class="iconify o-icon-svg o-icon" data-icon="fa:phone" data-inline="true"></i>',
'<i class="iconify o-icon-src-fa o-icon" data-icon="fa:phone" data-inline="true"></i>',
],
/** Iconify: all options */
[
@ -324,13 +324,13 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
'hidden' => true,
'classes' => 'icon-lg',
'attributes' => [
'data-swap' => 'Swap text',
'style' => 'color: #12a3eb;',
],
],
[
'ICON_PENCIL' => 'Pencil icon',
],
'<i class="iconify o-icon-svg o-icon icon-lg" title="Pencil icon" aria-hidden="true" data-icon="mdi:pencil" data-inline="true" data-swap="Swap text"></i>
'<i class="iconify o-icon-src-mdi o-icon icon-lg" title="Pencil icon" aria-hidden="true" data-icon="mdi:pencil" data-inline="true" style="color: #12a3eb;"></i>
<span class="sr-only">Pencil icon</span>',
],
/** PNG: default */