From 3cbeb7c96e2368405499345d91e605f02815341c Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Fri, 29 May 2026 00:11:21 -0500 Subject: [PATCH 1/2] feat: add distinct menu overrides for three layout types [skip bump] - mainmenu: collapsible navbar behind hamburger (primary nav) - horizontal: always-visible wrapping links (Quick Links, utility nav) - default: vertical list with title support (sidebar, footer) Each set has its own BEM prefix and sub-layouts (url, component, heading, separator). Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- src/html/mod_menu/default_component.php | 53 +++++++++++++++++++ src/html/mod_menu/default_heading.php | 30 +++++++++++ src/html/mod_menu/default_separator.php | 30 +++++++++++ src/html/mod_menu/default_url.php | 59 ++++++++++++++++++++++ src/html/mod_menu/horizontal.php | 23 +++------ src/html/mod_menu/horizontal_component.php | 9 +--- src/html/mod_menu/horizontal_heading.php | 8 +-- src/html/mod_menu/horizontal_separator.php | 7 +-- src/html/mod_menu/horizontal_url.php | 10 +--- 9 files changed, 186 insertions(+), 43 deletions(-) create mode 100644 src/html/mod_menu/default_component.php create mode 100644 src/html/mod_menu/default_heading.php create mode 100644 src/html/mod_menu/default_separator.php create mode 100644 src/html/mod_menu/default_url.php diff --git a/src/html/mod_menu/default_component.php b/src/html/mod_menu/default_component.php new file mode 100644 index 0000000..2242c7f --- /dev/null +++ b/src/html/mod_menu/default_component.php @@ -0,0 +1,53 @@ + + * + * 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 = '' . $item->title; + } else { + $linktype = '' . $item->title . ''; + } +} + +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); diff --git a/src/html/mod_menu/default_heading.php b/src/html/mod_menu/default_heading.php new file mode 100644 index 0000000..eeaaf2e --- /dev/null +++ b/src/html/mod_menu/default_heading.php @@ -0,0 +1,30 @@ + + * + * 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 = '' . $item->title; + } else { + $linktype = '' . $item->title . ''; + } +} + +?> +> diff --git a/src/html/mod_menu/default_separator.php b/src/html/mod_menu/default_separator.php new file mode 100644 index 0000000..1a08dbc --- /dev/null +++ b/src/html/mod_menu/default_separator.php @@ -0,0 +1,30 @@ + + * + * 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 = '' . $item->title; + } else { + $linktype = '' . $item->title . ''; + } +} + +?> +
/> diff --git a/src/html/mod_menu/default_url.php b/src/html/mod_menu/default_url.php new file mode 100644 index 0000000..55b6eab --- /dev/null +++ b/src/html/mod_menu/default_url.php @@ -0,0 +1,59 @@ + + * + * 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 = '' . $item->title; + } else { + $linktype = '' . $item->title . ''; + } +} + +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); diff --git a/src/html/mod_menu/horizontal.php b/src/html/mod_menu/horizontal.php index 2cfde6c..37d1f0e 100644 --- a/src/html/mod_menu/horizontal.php +++ b/src/html/mod_menu/horizontal.php @@ -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 ?> - diff --git a/src/html/mod_menu/horizontal_component.php b/src/html/mod_menu/horizontal_component.php index d2887cb..7619390 100644 --- a/src/html/mod_menu/horizontal_component.php +++ b/src/html/mod_menu/horizontal_component.php @@ -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 = '' . $item->title; } else { - // If the icon itself is the link, it needs a visually hidden text $linktype = '' . $item->title . ''; } } @@ -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'; diff --git a/src/html/mod_menu/horizontal_heading.php b/src/html/mod_menu/horizontal_heading.php index af61674..2bc20ef 100644 --- a/src/html/mod_menu/horizontal_heading.php +++ b/src/html/mod_menu/horizontal_heading.php @@ -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 = '' . $item->title; } else { - // If the icon itself is the link, it needs a visually hidden text $linktype = '' . $item->title . ''; } } -// 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'; } diff --git a/src/html/mod_menu/horizontal_separator.php b/src/html/mod_menu/horizontal_separator.php index 42579b9..d7625b6 100644 --- a/src/html/mod_menu/horizontal_separator.php +++ b/src/html/mod_menu/horizontal_separator.php @@ -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 = '' . $item->title; } else { - // If the icon itself is the link, it needs a visually hidden text $linktype = '' . $item->title . ''; } } ?> -> +> diff --git a/src/html/mod_menu/horizontal_url.php b/src/html/mod_menu/horizontal_url.php index 1d81553..2ed318d 100644 --- a/src/html/mod_menu/horizontal_url.php +++ b/src/html/mod_menu/horizontal_url.php @@ -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 = '' . $item->title; } else { - // If the icon itself is the link, it needs a visually hidden text $linktype = '' . $item->title . ''; } } @@ -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.52.0 From 4f56bb0563ace679cdfe56c788fb9580a9688c4a Mon Sep 17 00:00:00 2001 From: "gitea-actions[bot]" Date: Fri, 29 May 2026 05:11:34 +0000 Subject: [PATCH 2/2] chore: update development channel 02.08.00-dev [skip ci] --- updates.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updates.xml b/updates.xml index a1b8c2c..95ef82d 100644 --- a/updates.xml +++ b/updates.xml @@ -72,7 +72,7 @@ Template - MokoOnyx Template - MokoOnyx development build. - tpl_mokoonyx + mokoonyx template site 02.08.00-dev @@ -81,7 +81,7 @@ https://git.mokoconsulting.tech/MokoConsulting/MokoOnyx/releases/download/development/tpl_mokoonyx-02.08.00-dev.zip - fc5f52f498ce0ed66b3abc0abeb18d4129b8e3ef6254c5160915dd5ff89ebe16 + 56adfaf4c087f75187bc6bc302e6ea29353a0cc5e00c3f12fc5ddf3f66b6a854 dev Moko Consulting https://mokoconsulting.tech -- 2.52.0