mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15538] Add iconify
PHPBB3-15538
This commit is contained in:
parent
8e8532561b
commit
0eb9912af8
3 changed files with 37 additions and 1 deletions
|
@ -56,7 +56,7 @@ class icon extends \Twig\Extension\AbstractExtension
|
||||||
* Generate icon HTML for use in the template, depending on the mode.
|
* Generate icon HTML for use in the template, depending on the mode.
|
||||||
*
|
*
|
||||||
* @param environment $environment Twig environment object
|
* @param environment $environment Twig environment object
|
||||||
* @param string $type Icon type (font|png|svg)
|
* @param string $type Icon type (font|iconify|png|svg)
|
||||||
* @param string $icon Icon name (eg. "bold")
|
* @param string $icon Icon name (eg. "bold")
|
||||||
* @param string $title Icon title
|
* @param string $title Icon title
|
||||||
* @param bool $hidden Hide the icon title from view
|
* @param bool $hidden Hide the icon title from view
|
||||||
|
@ -72,6 +72,7 @@ class icon extends \Twig\Extension\AbstractExtension
|
||||||
switch ($type)
|
switch ($type)
|
||||||
{
|
{
|
||||||
case 'font':
|
case 'font':
|
||||||
|
case 'iconify':
|
||||||
$source = '';
|
$source = '';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
4
phpBB/styles/prosilver/template/icons/iconify.html
Normal file
4
phpBB/styles/prosilver/template/icons/iconify.html
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{% spaceless %}
|
||||||
|
<i class="iconify o-icon {{ 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 %}
|
|
@ -302,6 +302,37 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||||
'<i class="o-icon font fa-pencil a-class another-class" title="Pencil icon" aria-hidden="true" data-attr-1="true" data-attr-2="two"></i>
|
'<i class="o-icon font fa-pencil a-class another-class" title="Pencil icon" aria-hidden="true" data-attr-1="true" data-attr-2="two"></i>
|
||||||
<span class="sr-only">Pencil icon</span>'
|
<span class="sr-only">Pencil icon</span>'
|
||||||
],
|
],
|
||||||
|
/** Iconify: default */
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'type' => 'iconify',
|
||||||
|
'icon' => 'phone',
|
||||||
|
'title' => '',
|
||||||
|
'hidden' => false,
|
||||||
|
'classes' => '',
|
||||||
|
'attributes' => [],
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
'<i class="iconify o-icon phone"></i>',
|
||||||
|
],
|
||||||
|
/** Iconify: all options */
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'type' => 'iconify',
|
||||||
|
'icon' => 'pencil',
|
||||||
|
'title' => 'ICON_PENCIL',
|
||||||
|
'hidden' => true,
|
||||||
|
'classes' => 'icon-lg',
|
||||||
|
'attributes' => [
|
||||||
|
'data-swap' => 'Swap text',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'ICON_PENCIL' => 'Pencil icon',
|
||||||
|
],
|
||||||
|
'<i class="iconify o-icon pencil icon-lg" title="Pencil icon" aria-hidden="true" data-swap="Swap text"></i>
|
||||||
|
<span class="sr-only">Pencil icon</span>',
|
||||||
|
],
|
||||||
/** PNG: default */
|
/** PNG: default */
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
|
Loading…
Add table
Reference in a new issue