feat: distinct menu overrides for mainmenu, horizontal, default #90
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
*
|
||||
* This file is part of a Moko Consulting project.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default menu — Component item layout (sidebar/footer vertical lists)
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Filter\OutputFilter;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
$attributes = [];
|
||||
|
||||
if ($item->anchor_title) {
|
||||
$attributes['title'] = $item->anchor_title;
|
||||
}
|
||||
|
||||
if ($item->anchor_css) {
|
||||
$attributes['class'] = $item->anchor_css;
|
||||
}
|
||||
|
||||
if ($item->anchor_rel) {
|
||||
$attributes['rel'] = $item->anchor_rel;
|
||||
}
|
||||
|
||||
$linktype = $item->title;
|
||||
|
||||
if ($item->menu_icon) {
|
||||
if ($itemParams->get('menu_text', 1)) {
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
|
||||
} else {
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($item->browserNav == 1) {
|
||||
$attributes['target'] = '_blank';
|
||||
$attributes['rel'] = 'noopener noreferrer';
|
||||
} 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;";
|
||||
}
|
||||
|
||||
$attributes['class'] = 'nav-link mod-menu__link';
|
||||
|
||||
echo HTMLHelper::_('link', OutputFilter::ampReplace(htmlspecialchars($item->flink, ENT_COMPAT, 'UTF-8', false)), $linktype, $attributes);
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
*
|
||||
* This file is part of a Moko Consulting project.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default menu — Heading item layout (sidebar/footer vertical lists)
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$title = $item->anchor_title ? ' title="' . $item->anchor_title . '"' : '';
|
||||
$anchor_css = $item->anchor_css ?: '';
|
||||
|
||||
$linktype = $item->title;
|
||||
|
||||
if ($item->menu_icon) {
|
||||
if ($itemParams->get('menu_text', 1)) {
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
|
||||
} else {
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<span class="nav-link mod-menu__heading <?php echo $anchor_css; ?>"<?php echo $title; ?>><?php echo $linktype; ?></span>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
*
|
||||
* This file is part of a Moko Consulting project.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default menu — Separator item layout (sidebar/footer vertical lists)
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$title = $item->anchor_title ? ' title="' . $item->anchor_title . '"' : '';
|
||||
$anchor_css = $item->anchor_css ?: '';
|
||||
|
||||
$linktype = $item->title;
|
||||
|
||||
if ($item->menu_icon) {
|
||||
if ($itemParams->get('menu_text', 1)) {
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
|
||||
} else {
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<hr class="mod-menu__separator <?php echo $anchor_css; ?>"<?php echo $title; ?> />
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
||||
*
|
||||
* This file is part of a Moko Consulting project.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default menu — URL item layout (sidebar/footer vertical lists)
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Filter\OutputFilter;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
$attributes = [];
|
||||
|
||||
if ($item->anchor_title) {
|
||||
$attributes['title'] = $item->anchor_title;
|
||||
}
|
||||
|
||||
if ($item->anchor_css) {
|
||||
$attributes['class'] = $item->anchor_css;
|
||||
}
|
||||
|
||||
if ($item->anchor_rel) {
|
||||
$attributes['rel'] = $item->anchor_rel;
|
||||
}
|
||||
|
||||
$linktype = $item->title;
|
||||
|
||||
if ($item->menu_icon) {
|
||||
if ($itemParams->get('menu_text', 1)) {
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
|
||||
} else {
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($item->browserNav == 1) {
|
||||
$attributes['target'] = '_blank';
|
||||
$attributes['rel'] = 'noopener noreferrer';
|
||||
} 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;";
|
||||
}
|
||||
|
||||
$linkClass = 'nav-link mod-menu__link';
|
||||
|
||||
if (isset($attributes['class'])) {
|
||||
$attributes['class'] .= ' ' . $linkClass;
|
||||
} else {
|
||||
$attributes['class'] = $linkClass;
|
||||
}
|
||||
|
||||
echo HTMLHelper::_('link', OutputFilter::ampReplace(htmlspecialchars($item->flink, ENT_COMPAT, 'UTF-8', false)), $linktype, $attributes);
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main Menu - Mobile responsive collapsible dropdown menu override
|
||||
* Bootstrap 5 responsive navbar with hamburger menu
|
||||
* Horizontal menu — always-visible inline links that wrap on mobile.
|
||||
* No hamburger, no collapse. Suitable for Quick Links, utility nav, topbar menus.
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
@@ -22,19 +22,13 @@ if ($tagId = $params->get('tag_id', '')) {
|
||||
$id = ' id="' . $tagId . '"';
|
||||
}
|
||||
|
||||
// Get module class suffix
|
||||
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_COMPAT, 'UTF-8');
|
||||
|
||||
// The menu class is deprecated. Use mod-menu instead
|
||||
?>
|
||||
<nav class="mod-menu mod-menu-main navbar navbar-expand-lg<?php echo $moduleclass_sfx; ?>"<?php echo $id; ?>>
|
||||
<div class="container-fluid p-0">
|
||||
<!-- Collapsible menu content — toggle controlled by .nav-mobile-bar in index.php -->
|
||||
<div class="collapse navbar-collapse" id="moko-main-menu-collapse">
|
||||
<ul class="navbar-nav mod-menu-main__list">
|
||||
<nav class="mod-menu mod-menu-horizontal<?php echo $moduleclass_sfx; ?>"<?php echo $id; ?> aria-label="<?php echo htmlspecialchars($module->title, ENT_COMPAT, 'UTF-8'); ?>">
|
||||
<ul class="nav mod-menu-horizontal__list flex-wrap">
|
||||
<?php foreach ($list as $i => &$item) :
|
||||
$itemParams = $item->getParams();
|
||||
$class = 'nav-item mod-menu-main__item item-' . $item->id;
|
||||
$class = 'nav-item mod-menu-horizontal__item item-' . $item->id;
|
||||
|
||||
if ($item->id == $default_id) {
|
||||
$class .= ' default';
|
||||
@@ -83,19 +77,14 @@ $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_COM
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
// The next item is deeper.
|
||||
if ($item->deeper) {
|
||||
echo '<ul class="dropdown-menu mod-menu-main__dropdown">';
|
||||
echo '<ul class="dropdown-menu mod-menu-horizontal__dropdown">';
|
||||
} elseif ($item->shallower) {
|
||||
// The next item is shallower.
|
||||
echo '</li>';
|
||||
echo str_repeat('</ul></li>', $item->level_diff);
|
||||
} else {
|
||||
// The next item is on the same level.
|
||||
echo '</li>';
|
||||
}
|
||||
endforeach;
|
||||
?></ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main Menu - Component item layout
|
||||
* Horizontal menu — Component item layout
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
@@ -33,12 +33,9 @@ if ($item->anchor_rel) {
|
||||
$linktype = $item->title;
|
||||
|
||||
if ($item->menu_icon) {
|
||||
// The link is an icon
|
||||
if ($itemParams->get('menu_text', 1)) {
|
||||
// If the link text is to be displayed, the icon is added with aria-hidden
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
|
||||
} else {
|
||||
// If the icon itself is the link, it needs a visually hidden text
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
|
||||
}
|
||||
}
|
||||
@@ -48,12 +45,10 @@ if ($item->browserNav == 1) {
|
||||
$attributes['rel'] = 'noopener noreferrer';
|
||||
} 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;";
|
||||
}
|
||||
|
||||
// Add dropdown toggle for items with children
|
||||
$linkClass = 'nav-link mod-menu-main__link';
|
||||
$linkClass = 'nav-link mod-menu-horizontal__link';
|
||||
if ($item->deeper) {
|
||||
$linkClass .= ' dropdown-toggle';
|
||||
$attributes['data-bs-toggle'] = 'dropdown';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main Menu - Heading item layout
|
||||
* Horizontal menu — Heading item layout
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
@@ -19,18 +19,14 @@ $anchor_css = $item->anchor_css ?: '';
|
||||
$linktype = $item->title;
|
||||
|
||||
if ($item->menu_icon) {
|
||||
// The link is an icon
|
||||
if ($itemParams->get('menu_text', 1)) {
|
||||
// If the link text is to be displayed, the icon is added with aria-hidden
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
|
||||
} else {
|
||||
// If the icon itself is the link, it needs a visually hidden text
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
// Add dropdown toggle for items with children
|
||||
$headingClass = 'nav-link mod-menu-main__heading';
|
||||
$headingClass = 'nav-link mod-menu-horizontal__heading';
|
||||
if ($item->deeper) {
|
||||
$headingClass .= ' dropdown-toggle';
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main Menu - Separator item layout
|
||||
* Horizontal menu — Separator item layout
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
@@ -19,15 +19,12 @@ $anchor_css = $item->anchor_css ?: '';
|
||||
$linktype = $item->title;
|
||||
|
||||
if ($item->menu_icon) {
|
||||
// The link is an icon
|
||||
if ($itemParams->get('menu_text', 1)) {
|
||||
// If the link text is to be displayed, the icon is added with aria-hidden
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
|
||||
} else {
|
||||
// If the icon itself is the link, it needs a visually hidden text
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<span class="dropdown-divider mod-menu-main__separator <?php echo $anchor_css; ?>"<?php echo $title; ?>><?php echo $linktype; ?></span>
|
||||
<span class="dropdown-divider mod-menu-horizontal__separator <?php echo $anchor_css; ?>"<?php echo $title; ?>><?php echo $linktype; ?></span>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main Menu - URL item layout
|
||||
* Horizontal menu — URL item layout
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
@@ -33,12 +33,9 @@ if ($item->anchor_rel) {
|
||||
$linktype = $item->title;
|
||||
|
||||
if ($item->menu_icon) {
|
||||
// The link is an icon
|
||||
if ($itemParams->get('menu_text', 1)) {
|
||||
// If the link text is to be displayed, the icon is added with aria-hidden
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span>' . $item->title;
|
||||
} else {
|
||||
// If the icon itself is the link, it needs a visually hidden text
|
||||
$linktype = '<span class="' . $item->menu_icon . '" aria-hidden="true"></span><span class="visually-hidden">' . $item->title . '</span>';
|
||||
}
|
||||
}
|
||||
@@ -48,12 +45,10 @@ if ($item->browserNav == 1) {
|
||||
$attributes['rel'] = 'noopener noreferrer';
|
||||
} 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;";
|
||||
}
|
||||
|
||||
// Add dropdown toggle for items with children
|
||||
$linkClass = 'nav-link mod-menu-main__link';
|
||||
$linkClass = 'nav-link mod-menu-horizontal__link';
|
||||
if ($item->deeper) {
|
||||
$linkClass .= ' dropdown-toggle';
|
||||
$attributes['data-bs-toggle'] = 'dropdown';
|
||||
@@ -61,7 +56,6 @@ if ($item->deeper) {
|
||||
$attributes['aria-expanded'] = 'false';
|
||||
}
|
||||
|
||||
// Merge existing class with our class
|
||||
if (isset($attributes['class'])) {
|
||||
$attributes['class'] .= ' ' . $linkClass;
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@
|
||||
<update>
|
||||
<name>Template - MokoOnyx</name>
|
||||
<description>Template - MokoOnyx development build.</description>
|
||||
<element>tpl_mokoonyx</element>
|
||||
<element>mokoonyx</element>
|
||||
<type>template</type>
|
||||
<client>site</client>
|
||||
<version>02.08.00-dev</version>
|
||||
@@ -81,7 +81,7 @@
|
||||
<downloads>
|
||||
<downloadurl type='full' format='zip'>https://git.mokoconsulting.tech/MokoConsulting/MokoOnyx/releases/download/development/tpl_mokoonyx-02.08.00-dev.zip</downloadurl>
|
||||
</downloads>
|
||||
<sha256>fc5f52f498ce0ed66b3abc0abeb18d4129b8e3ef6254c5160915dd5ff89ebe16</sha256>
|
||||
<sha256>56adfaf4c087f75187bc6bc302e6ea29353a0cc5e00c3f12fc5ddf3f66b6a854</sha256>
|
||||
<tags><tag>dev</tag></tags>
|
||||
<maintainer>Moko Consulting</maintainer>
|
||||
<maintainerurl>https://mokoconsulting.tech</maintainerurl>
|
||||
|
||||
Reference in New Issue
Block a user