Skip to content

Commit e6577f1

Browse files
authored
[6.0] Fix menu item startlevel handling higher than 1 (#46484)
1 parent 1f070ee commit e6577f1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

modules/mod_menu/tmpl/default.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
$wa->getRegistry()->addExtensionRegistryFile('mod_menu');
1919
$wa->usePreset('mod_menu.menu');
2020

21-
$tagId = $params->get('tag_id', '') ?: 'mod-menu' . $module->id;
22-
$id = ' id="' . htmlspecialchars($tagId, ENT_QUOTES, 'UTF-8') . '"';
21+
$tagId = $params->get('tag_id', '') ?: 'mod-menu' . $module->id;
22+
$id = ' id="' . htmlspecialchars($tagId, ENT_QUOTES, 'UTF-8') . '"';
23+
$startLevel = (int) $params->get('startLevel', 1);
2324

2425
// The menu class is deprecated. Use mod-menu instead
2526
?>
@@ -63,7 +64,7 @@
6364
echo '<li class="' . $class . '">';
6465

6566
// The next item is deeper - add toggle only here it is a heading or separator
66-
if ($item->deeper && $item->level === 1 && in_array($item->type, ['separator', 'heading'])) {
67+
if ($item->deeper && (int) $item->level === $startLevel && in_array($item->type, ['separator', 'heading'])) {
6768
// Add a toggle button.
6869
echo '<button class="mod-menu__toggle-sub" aria-expanded="false">';
6970
}
@@ -85,7 +86,7 @@
8586
if ($item->deeper) {
8687
// Check type - add only on first level
8788
// @todo aria-label - set in menu item ???
88-
if ($item->level === 1) {
89+
if ((int) $item->level === $startLevel) {
8990
switch ($item->type) {
9091
case 'heading':
9192
case 'separator':

0 commit comments

Comments
 (0)