diff --git a/phpBB/phpbb/template/twig/extension/icon.php b/phpBB/phpbb/template/twig/extension/icon.php index 065364a3e6..07b01eee4b 100644 --- a/phpBB/phpbb/template/twig/extension/icon.php +++ b/phpBB/phpbb/template/twig/extension/icon.php @@ -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(); diff --git a/phpBB/styles/all/templates/macros/icons/iconify.html b/phpBB/styles/all/templates/macros/icons/iconify.html index 6c3c269186..43b8b88948 100644 --- a/phpBB/styles/all/templates/macros/icons/iconify.html +++ b/phpBB/styles/all/templates/macros/icons/iconify.html @@ -1,4 +1,4 @@ {% spaceless %} - + {% if TITLE %}{{ lang(TITLE) }}{% endif %} {% endspaceless %} diff --git a/tests/template/extension_test.php b/tests/template/extension_test.php index 7c12a81842..b46e83c7cd 100644 --- a/tests/template/extension_test.php +++ b/tests/template/extension_test.php @@ -313,7 +313,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case 'attributes' => [], ], [], - '', + '', ], /** 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', ], - ' + ' Pencil icon', ], /** PNG: default */