90 lines
2.2 KiB
PHP
90 lines
2.2 KiB
PHP
<?php
|
|
use Joomla\CMS\Helper\ModuleHelper;
|
|
use Joomla\CMS\HTML\HTMLHelper;
|
|
|
|
$hasChildren = $item->hasChildren() && ($item->level < $params['endLevel']);
|
|
$hasParent = $item->hasParent();
|
|
|
|
$itemParams = $item->getParams();
|
|
$class = 'item-' . $item->id;
|
|
$mi_class = 'nav-link';
|
|
$attributes = array();
|
|
|
|
if ($hasParent)
|
|
{
|
|
$mi_class .= " dropdown-item";
|
|
} else {
|
|
// $class .= " nav-item";
|
|
}
|
|
$class .= " nav-item";
|
|
|
|
if ($hasChildren)
|
|
{
|
|
$class .= " dropdown";
|
|
$mi_class .= " dropdown-toggle";
|
|
$attributes["role"] = 'button';
|
|
}
|
|
if ($item->type === 'separator')
|
|
{
|
|
$class .= ' divider';
|
|
}
|
|
if ($item->id == $default_id)
|
|
{
|
|
$class .= ' default';
|
|
}
|
|
|
|
if ($item->id == $active_id || ($item->type === 'alias' && $itemParams->get('aliasoptions') == $active_id))
|
|
{
|
|
$class .= ' current';
|
|
}
|
|
|
|
if ($item->browserNav == 1)
|
|
{
|
|
$attributes['target'] = '_blank';
|
|
$attributes['rel'] = 'noopener noreferrer';
|
|
|
|
if ($item->anchor_rel == 'nofollow')
|
|
{
|
|
$attributes['rel'] .= ' nofollow';
|
|
}
|
|
}
|
|
elseif ($item->browserNav == 2)
|
|
{
|
|
$options = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,' . $params->get('window_open');
|
|
|
|
$attributes['onclick'] = "window.open(this.href, 'targetWindow', '" . $options . "'); return false;";
|
|
}
|
|
|
|
echo '<li class="' . $class . '">';
|
|
|
|
switch ($item->type) :
|
|
case 'heading':
|
|
require ModuleHelper::getLayoutPath('mod_menu', 'item-heading');
|
|
break;
|
|
case 'component':
|
|
case 'url':
|
|
require ModuleHelper::getLayoutPath('mod_menu', 'item-url');
|
|
break;
|
|
case 'separator':
|
|
break;
|
|
default:
|
|
require ModuleHelper::getLayoutPath('mod_menu', 'item-url');
|
|
break;
|
|
endswitch;
|
|
|
|
if ($hasChildren)
|
|
{
|
|
echo '<ul class="dropdown-menu" aria-labelledby="mi-'.$item->id.'">';
|
|
|
|
foreach ($item->getChildren() as $i => &$item)
|
|
{
|
|
|
|
require ModuleHelper::getLayoutPath('mod_menu', 'item');
|
|
}
|
|
|
|
echo "</ul>";
|
|
}
|
|
|
|
echo "</li>";
|
|
|
|
?>
|