[ 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) 2009 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 15 /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ 16 $wa = $app->getDocument()->getWebAssetManager(); 17 $wa->registerAndUseScript('mod_menu', 'mod_menu/menu.min.js', [], ['type' => 'module']); 18 $wa->registerAndUseScript('mod_menu', 'mod_menu/menu-es5.min.js', [], ['nomodule' => true, 'defer' => true]); 19 20 $id = ''; 21 22 if ($tagId = $params->get('tag_id', '')) { 23 $id = ' id="' . $tagId . '"'; 24 } 25 26 // The menu class is deprecated. Use mod-menu instead 27 ?> 28 <ul<?php echo $id; ?> class="mod-menu mod-list nav <?php echo $class_sfx; ?>"> 29 <?php foreach ($list as $i => &$item) { 30 $itemParams = $item->getParams(); 31 $class = 'nav-item item-' . $item->id; 32 33 if ($item->id == $default_id) { 34 $class .= ' default'; 35 } 36 37 if ($item->id == $active_id || ($item->type === 'alias' && $itemParams->get('aliasoptions') == $active_id)) { 38 $class .= ' current'; 39 } 40 41 if (in_array($item->id, $path)) { 42 $class .= ' active'; 43 } elseif ($item->type === 'alias') { 44 $aliasToId = $itemParams->get('aliasoptions'); 45 46 if (count($path) > 0 && $aliasToId == $path[count($path) - 1]) { 47 $class .= ' active'; 48 } elseif (in_array($aliasToId, $path)) { 49 $class .= ' alias-parent-active'; 50 } 51 } 52 53 if ($item->type === 'separator') { 54 $class .= ' divider'; 55 } 56 57 if ($item->deeper) { 58 $class .= ' deeper'; 59 } 60 61 if ($item->parent) { 62 $class .= ' parent'; 63 } 64 65 echo '<li class="' . $class . '">'; 66 67 switch ($item->type) : 68 case 'separator': 69 case 'component': 70 case 'heading': 71 case 'url': 72 require ModuleHelper::getLayoutPath('mod_menu', 'default_' . $item->type); 73 break; 74 75 default: 76 require ModuleHelper::getLayoutPath('mod_menu', 'default_url'); 77 break; 78 endswitch; 79 80 // The next item is deeper. 81 if ($item->deeper) { 82 echo '<ul class="mod-menu__sub list-unstyled small">'; 83 } elseif ($item->shallower) { 84 // The next item is shallower. 85 echo '</li>'; 86 echo str_repeat('</ul></li>', $item->level_diff); 87 } else { 88 // The next item is on the same level. 89 echo '</li>'; 90 } 91 } 92 ?></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 |