Skip to content

Commit 8c22de4

Browse files
infograf768HLeithner
authored andcommitted
[4.0][Admin template] Menu Dashboard: Display language badge for menus containing home (#25944)
1 parent baa42d5 commit 8c22de4

File tree

1 file changed

+24
-0
lines changed
  • administrator/modules/mod_submenu/Menu

1 file changed

+24
-0
lines changed

administrator/modules/mod_submenu/Menu/Menu.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Joomla\CMS\Component\ComponentHelper;
1515
use Joomla\CMS\Factory;
16+
use Joomla\CMS\HTML\HTMLHelper;
1617
use Joomla\CMS\Language\Text;
1718
use Joomla\CMS\Menu\MenuItem;
1819
use Joomla\Component\Menus\Administrator\Helper\MenusHelper;
@@ -159,6 +160,29 @@ public static function preprocess($parent)
159160
continue;
160161
}
161162
}
163+
elseif ($item->element === 'com_menus')
164+
{
165+
// Get badges for Menus containing a Home page.
166+
$iconImage = $item->icon;
167+
168+
if ($iconImage)
169+
{
170+
if (substr($iconImage, 0, 6) === 'class:' && substr($iconImage, 6) === 'icon-home')
171+
{
172+
$iconImage = '<span class="home-image icon-featured"></span>';
173+
}
174+
elseif (substr($iconImage, 0, 6) === 'image:')
175+
{
176+
$iconImage = '&nbsp;<span class="badge badge-secondary">' . substr($iconImage, 6) . '</span>';
177+
}
178+
else
179+
{
180+
$iconImage = '<span>' . HTMLHelper::_('image', $iconImage, null) . '</span>';
181+
}
182+
183+
$item->title = $item->title . $iconImage;
184+
}
185+
}
162186

163187
if ($item->hasChildren())
164188
{

0 commit comments

Comments
 (0)