diff --git a/layouts/joomla/button/iconclass.php b/layouts/joomla/button/iconclass.php index f7e137a45bc7c..bbaa337ba13b3 100644 --- a/layouts/joomla/button/iconclass.php +++ b/layouts/joomla/button/iconclass.php @@ -9,113 +9,8 @@ defined('_JEXEC') or die; -// Convert icomoon to fa -$icon = $displayData['icon']; +use Joomla\CMS\Layout\LayoutHelper; -if(strpos($icon, 'fa-') == true || strpos($icon, 'icon-') == true){ - $icon = $icon; -} -elseif ($icon === 'archive' || $icon === 'folder-close' || $icon === 'folder-folder-2' || $icon === 'folder-minus' || $icon === 'folder-plus-2' || $icon === 'folder-remove' || $icon === 'drawer-2') -{ - $icon = 'fas fa-folder'; -} -elseif ($icon === 'publish') -{ - $icon = 'fas fa-check'; -} -elseif ($icon === 'unpublish' || $icon === 'cancel' || $icon === 'delete' || $icon === 'remove') -{ - $icon = 'fas fa-times'; -} -elseif ($icon === 'new' || $icon === 'save-new') -{ - $icon = 'fas fa-plus'; -} -elseif ($icon === 'apply' || $icon === 'save') -{ - $icon = 'fas fa-save'; -} -elseif ($icon === 'mail') -{ - $icon = 'fas fa-envelope'; -} -elseif ($icon === 'unfeatured' || $icon === 'asterisk') -{ - $icon = 'fas fa-star'; -} -elseif ($icon === 'featured') -{ - $icon = 'fas fa-star featured'; -} -elseif ($icon === 'checkedout') -{ - $icon = 'fas fa-lock'; -} -elseif ($icon === 'eye-close') -{ - $icon = 'fas fa-eye-slash'; -} -elseif ($icon === 'eye-open') -{ - $icon = 'fas fa-eye'; -} -elseif ($icon === 'loop' || $icon === 'refresh' || $icon === 'unblock') -{ - $icon = 'fas fa-sync'; -} -elseif ($icon === 'contract') -{ - $icon = 'fas fa-compress'; -} -elseif ($icon === 'purge') -{ - $icon = 'fas fa-trash'; -} -elseif ($icon === 'options') -{ - $icon = 'fas fa-cog'; -} -elseif ($icon === 'expired') -{ - $icon = 'fas fa-minus-circle'; -} -elseif ($icon === 'save-copy') -{ - $icon = 'fas fa-copy'; -} -elseif ($icon === 'checkin') -{ - $icon = 'fas fa-check-square'; -} -elseif ($icon === 'generic') -{ - $icon = 'fas fa-dot-circle'; -} -elseif ($icon === 'list-2') -{ - $icon = 'fas fa-list-ul'; -} -elseif ($icon === 'default') -{ - $icon = 'fas fa-home'; -} -elseif ($icon === 'crop') -{ - $icon = 'fas fa-crop'; -} -elseif ($icon === 'chevron-down') -{ - $icon = 'fas fa-chevron-down'; -} -elseif ($icon === 'times') -{ - $icon = 'fas fa-times'; -} -elseif ($icon === 'move') -{ - $icon = 'fas fa-arrows-alt'; -} -else{ - $icon = 'icon-' . $icon; -} -echo $icon; +$displayData['html'] = false; + +echo LayoutHelper::render('joomla.icon.iconclass', $displayData); diff --git a/layouts/joomla/content/info_block/category.php b/layouts/joomla/content/info_block/category.php index 0c3035f3b4ee8..8f4ba088f798f 100644 --- a/layouts/joomla/content/info_block/category.php +++ b/layouts/joomla/content/info_block/category.php @@ -10,12 +10,13 @@ defined('_JEXEC') or die; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\Component\Content\Site\Helper\RouteHelper; ?>
- + 'fa-folder-open fa-fw']); ?> escape($displayData['item']->category_title); ?> get('link_category') && !empty($displayData['item']->catid)) : ?> '; +} + +echo $icon; diff --git a/layouts/joomla/toolbar/iconclass.php b/layouts/joomla/toolbar/iconclass.php index 15abd51c740fd..bbaa337ba13b3 100644 --- a/layouts/joomla/toolbar/iconclass.php +++ b/layouts/joomla/toolbar/iconclass.php @@ -9,114 +9,8 @@ defined('_JEXEC') or die; -// Convert icomoon to fa -$icon = $displayData['icon']; +use Joomla\CMS\Layout\LayoutHelper; -if(strpos($icon, 'fa-') == true || strpos($icon, 'icon-') == true){ - $icon = $icon; -} -elseif ($icon === 'archive' || $icon === 'folder-close' || $icon === 'folder-folder-2' || $icon === 'folder-minus' || $icon === 'folder-plus-2' || $icon === 'folder-remove' || $icon === 'drawer-2') -{ - $icon = 'fas fa-folder'; -} -elseif ($icon === 'publish') -{ - $icon = 'fas fa-check'; -} -elseif ($icon === 'unpublish' || $icon === 'cancel' || $icon === 'delete' || $icon === 'remove') -{ - $icon = 'fas fa-times'; -} -elseif ($icon === 'new' || $icon === 'save-new') -{ - $icon = 'fas fa-plus'; -} -elseif ($icon === 'apply' || $icon === 'save') -{ - $icon = 'fas fa-save'; -} -elseif ($icon === 'mail') -{ - $icon = 'fas fa-envelope'; -} -elseif ($icon === 'unfeatured' || $icon === 'asterisk') -{ - $icon = 'fas fa-star'; -} -elseif ($icon === 'featured') -{ - $icon = 'fas fa-star featured'; -} -elseif ($icon === 'checkedout') -{ - $icon = 'fas fa-lock'; -} -elseif ($icon === 'eye-close') -{ - $icon = 'fas fa-eye-slash'; -} -elseif ($icon === 'eye-open') -{ - $icon = 'fas fa-eye'; -} -elseif ($icon === 'loop' || $icon === 'refresh' || $icon === 'unblock') -{ - $icon = 'fas fa-sync'; -} -elseif ($icon === 'contract') -{ - $icon = 'fas fa-compress'; -} -elseif ($icon === 'purge') -{ - $icon = 'fas fa-trash'; -} -elseif ($icon === 'options') -{ - $icon = 'fas fa-cog'; -} -elseif ($icon === 'expired') -{ - $icon = 'fas fa-minus-circle'; -} -elseif ($icon === 'save-copy') -{ - $icon = 'fas fa-copy'; -} -elseif ($icon === 'checkin') -{ - $icon = 'fas fa-check-square'; -} -elseif ($icon === 'generic') -{ - $icon = 'fas fa-dot-circle'; -} -elseif ($icon === 'list-2') -{ - $icon = 'fas fa-list-ul'; -} -elseif ($icon === 'default') -{ - $icon = 'fas fa-home'; -} -elseif ($icon === 'crop') -{ - $icon = 'fas fa-crop'; -} -elseif ($icon === 'chevron-down') -{ - $icon = 'fas fa-chevron-down'; -} -elseif ($icon === 'times') -{ - $icon = 'fas fa-times'; -} -elseif ($icon === 'move') -{ - $icon = 'fas fa-arrows-alt'; -} -else -{ - $icon = 'icon-' . $icon; -} -echo $icon; +$displayData['html'] = false; + +echo LayoutHelper::render('joomla.icon.iconclass', $displayData); diff --git a/libraries/src/HTML/Helpers/ActionsDropdown.php b/libraries/src/HTML/Helpers/ActionsDropdown.php index 015b63336f4e7..b6f6ee304c96b 100644 --- a/libraries/src/HTML/Helpers/ActionsDropdown.php +++ b/libraries/src/HTML/Helpers/ActionsDropdown.php @@ -10,7 +10,9 @@ defined('JPATH_PLATFORM') or die; +use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; /** * HTML utility class for building a dropdown menu @@ -226,10 +228,13 @@ public static function divider() public static function addCustomItem($label, $icon = '', $id = '', $task = '') { static::$dropDownList[] = '
  • ' - . '' - . ($icon ? ' ' : '') - . $label - . '' + . HTMLHelper::link( + 'javascript://', + ($icon ? LayoutHelper::render('joomla.icon.iconclass', ['icon' => $icon]) : '') . $label, + [ + 'onclick' => 'Joomla.listItemTask(\'' . $id . '\', \'' . $task . '\')' + ] + ) . '
  • '; } } diff --git a/libraries/src/HTML/Helpers/JGrid.php b/libraries/src/HTML/Helpers/JGrid.php index a68a32a41fb56..e7d5ec8e61d10 100644 --- a/libraries/src/HTML/Helpers/JGrid.php +++ b/libraries/src/HTML/Helpers/JGrid.php @@ -13,6 +13,7 @@ use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; use Joomla\Utilities\ArrayHelper; /** @@ -89,45 +90,7 @@ public static function action($i, $task, $prefix = '', $active_title = '', $inac $html[] = $tip ? ' aria-labelledby="' . $ariaid . '"' : ''; $html[] = '>'; - - if (strpos($active_class, 'fa-') !== false) - { - $active_class = 'fas ' . $active_class; - } - elseif (strpos($active_class, 'icon-') !== false) - { - $active_class = $active_class; - } - elseif ($active_class === 'publish') - { - $active_class = 'fas fa-check'; - } - elseif ($active_class === 'unpublish') - { - $active_class = 'fas fa-times'; - } - elseif ($active_class === 'archive') - { - $active_class = 'fas fa-folder'; - } - elseif ($active_class === 'checkedout') - { - $active_class = 'fas fa-lock'; - } - elseif ($active_class === 'unfeatured') - { - $active_class = 'fas fa-star'; - } - elseif ($active_class === 'featured') - { - $active_class = 'fas fa-star featured'; - } - else - { - $active_class = 'icon-' . $active_class; - } - - $html[] = ''; + $html[] = LayoutHelper::render('joomla.icon.iconclass', ['icon' => $active_class]); $html[] = ''; $html[] = $tip ? '' : ''; } @@ -136,53 +99,7 @@ public static function action($i, $task, $prefix = '', $active_title = '', $inac $html[] = ''; - } - + $html[] = LayoutHelper::render('joomla.icon.iconclass', ['icon' => $inactive_class]); $html[] = ''; $html[] = $tip ? '' : ''; } diff --git a/libraries/src/Toolbar/ToolbarButton.php b/libraries/src/Toolbar/ToolbarButton.php index dae3f39743b7b..9bedf2fa5bff3 100644 --- a/libraries/src/Toolbar/ToolbarButton.php +++ b/libraries/src/Toolbar/ToolbarButton.php @@ -197,6 +197,7 @@ protected function renderButton(array &$options): string // Isolate button class from icon class $buttonClass = str_replace('fas fa-', '', $this->getName()); + $buttonClass = str_ireplace('fa-', '', $buttonClass); $iconclass = $options['btnClass'] ?? ''; $options['btnClass'] = 'button-' . $buttonClass . ' ' . $iconclass;