mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15538] Add iconify source class
PHPBB3-15538
This commit is contained in:
parent
fa8cf86e63
commit
8bac1daba7
3 changed files with 14 additions and 5 deletions
|
@ -69,13 +69,22 @@ class icon extends \Twig\Extension\AbstractExtension
|
||||||
{
|
{
|
||||||
$type = strtolower($type);
|
$type = strtolower($type);
|
||||||
|
|
||||||
|
if (empty($icon))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
switch ($type)
|
switch ($type)
|
||||||
{
|
{
|
||||||
case 'font':
|
case 'font':
|
||||||
case 'iconify':
|
|
||||||
$source = '';
|
$source = '';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'iconify':
|
||||||
|
$source = explode(':', $icon);
|
||||||
|
$source = $source[0];
|
||||||
|
break;
|
||||||
|
|
||||||
case 'png':
|
case 'png':
|
||||||
$board_url = defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH;
|
$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();
|
$web_path = $board_url ? generate_board_url() . '/' : $environment->get_web_root_path();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% spaceless %}
|
{% 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 %}
|
{% if TITLE %}<span{% if S_HIDDEN %} class="sr-only"{% endif %}>{{ lang(TITLE) }}</span>{% endif %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
|
|
|
@ -313,7 +313,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
'attributes' => [],
|
'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 */
|
/** Iconify: all options */
|
||||||
[
|
[
|
||||||
|
@ -324,13 +324,13 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
'hidden' => true,
|
'hidden' => true,
|
||||||
'classes' => 'icon-lg',
|
'classes' => 'icon-lg',
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'data-swap' => 'Swap text',
|
'style' => 'color: #12a3eb;',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'ICON_PENCIL' => 'Pencil icon',
|
'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>',
|
<span class="sr-only">Pencil icon</span>',
|
||||||
],
|
],
|
||||||
/** PNG: default */
|
/** PNG: default */
|
||||||
|
|
Loading…
Add table
Reference in a new issue