[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 5 * @subpackage mod_menu 6 * 7 * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 defined('_JEXEC') or die; 12 13 use Joomla\CMS\Helper\ModuleHelper; 14 use Joomla\Utilities\ArrayHelper; 15 16 /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */ 17 $wa = $app->getDocument()->getWebAssetManager(); 18 $wa->registerAndUseScript('metismenu', 'media/templates/site/cassiopeia/js/mod_menu/menu-metismenu.min.js', [], ['defer' => true], ['metismenujs']); 19 20 $attributes = []; 21 $attributes['class'] = 'mod-menu mod-menu_dropdown-metismenu metismenu mod-list ' . $class_sfx; 22 23 if ($tagId = $params->get('tag_id', '')) { 24 $attributes['id'] = $tagId; 25 } 26 27 $start = (int) $params->get('startLevel', 1); 28 29 ?> 30 <ul <?php echo ArrayHelper::toString($attributes); ?>> 31 <?php foreach ($list as $i => &$item) { 32 // Skip sub-menu items if they are set to be hidden in the module's options 33 if (!$showAll && $item->level > $start) { 34 continue; 35 } 36 37 $itemParams = $item->getParams(); 38 $class = []; 39 $class[] = 'metismenu-item item-' . $item->id . ' level-' . ($item->level - $start + 1); 40 41 if ($item->id == $default_id) { 42 $class[] = 'default'; 43 } 44 45 if ($item->id == $active_id || ($item->type === 'alias' && $itemParams->get('aliasoptions') == $active_id)) { 46 $class[] = 'current'; 47 } 48 49 if (in_array($item->id, $path)) { 50 $class[] = 'active'; 51 } elseif ($item->type === 'alias') { 52 $aliasToId = $itemParams->get('aliasoptions'); 53 54 if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) { 55 $class[] = 'active'; 56 } elseif (in_array($aliasToId, $path)) { 57 $class[] = 'alias-parent-active'; 58 } 59 } 60 61 if ($item->type === 'separator') { 62 $class[] = 'divider'; 63 } 64 65 if ($showAll) { 66 if ($item->deeper) { 67 $class[] = 'deeper'; 68 } 69 70 if ($item->parent) { 71 $class[] = 'parent'; 72 } 73 } 74 75 echo '<li class="' . implode(' ', $class) . '">'; 76 77 switch ($item->type) : 78 case 'separator': 79 case 'component': 80 case 'heading': 81 case 'url': 82 require ModuleHelper::getLayoutPath('mod_menu', 'dropdown-metismenu_' . $item->type); 83 break; 84 85 default: 86 require ModuleHelper::getLayoutPath('mod_menu', 'dropdown-metismenu_url'); 87 endswitch; 88 89 switch (true) : 90 // The next item is deeper. 91 case $showAll && $item->deeper: 92 echo '<ul class="mm-collapse">'; 93 break; 94 95 // The next item is shallower. 96 case $item->shallower: 97 echo '</li>'; 98 echo str_repeat('</ul></li>', $item->level_diff); 99 break; 100 101 // The next item is on the same level. 102 default: 103 echo '</li>'; 104 break; 105 endswitch; 106 } 107 ?></ul>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |