From f935096762d127c606fee91fa0f9721b2408457b Mon Sep 17 00:00:00 2001 From: John Rayes Date: Tue, 10 Aug 2021 21:32:18 -0700 Subject: [PATCH] Simplify the code a little by removing `hide_subsections` Also remove the `disabled` flag as it really wasn't needed Alternative fix for #6925 ref #6926 Signed-off-by: John Rayes --- Sources/Subs-Menu.php | 20 -------------------- Themes/default/GenericMenu.template.php | 16 +++------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/Sources/Subs-Menu.php b/Sources/Subs-Menu.php index bdea2200ee..5625067dd8 100644 --- a/Sources/Subs-Menu.php +++ b/Sources/Subs-Menu.php @@ -225,9 +225,6 @@ function createMenu($menuData, $menuOptions = array()) // Let's assume this is the last, for now. $last_sa = $sa; } - // Mark it as disabled... - else - $menu_context['sections'][$section_id]['areas'][$area_id]['subsections'][$sa]['disabled'] = true; } // Set which one is first, last and selected in the group. @@ -267,23 +264,6 @@ function createMenu($menuData, $menuOptions = array()) } } - foreach ($menu_context['sections'] as $section_id => $section) - { - if (!empty($section['areas'])) - { - foreach ($section['areas'] as $area_id => $area) - { - if (!empty($area['subsections'])) - { - $menu_context['sections'][$section_id]['areas'][$area_id]['hide_subsections'] = true; - - foreach ($area['subsections'] as $sa => $sub) - $menu_context['sections'][$section_id]['areas'][$area_id]['hide_subsections'] &= !empty($sub['disabled']); - } - } - } - } - // Should we use a custom base url, or use the default? $menu_context['base_url'] = isset($menuOptions['base_url']) ? $menuOptions['base_url'] : $scripturl . '?action=' . $menu_context['current_action']; diff --git a/Themes/default/GenericMenu.template.php b/Themes/default/GenericMenu.template.php index ea5948c53e..66fa515120 100644 --- a/Themes/default/GenericMenu.template.php +++ b/Themes/default/GenericMenu.template.php @@ -92,7 +92,7 @@ function template_generic_menu(&$menu_context) continue; echo ' - + ', $area['icon'], $area['label'], !empty($area['amt']) ? ' ' . $area['amt'] . '' : '', ''; // Is this the current area, or just some area? @@ -100,16 +100,13 @@ function template_generic_menu(&$menu_context) $context['tabs'] = isset($area['subsections']) ? $area['subsections'] : array(); // Are there any subsections? - if (!empty($area['subsections']) && empty($area['hide_subsections'])) + if (!empty($area['subsections'])) { echo '
    '; foreach ($area['subsections'] as $sa => $sub) { - if (!empty($sub['disabled'])) - continue; - $url = isset($sub['url']) ? $sub['url'] : (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $i) . ';sa=' . $sa; echo ' @@ -163,13 +160,6 @@ function template_generic_menu_tabs(&$menu_context) { foreach ($context['tabs'] as $id => $tab) { - // Can this not be accessed? - if (!empty($tab['disabled'])) - { - $tab_context['tabs'][$id]['disabled'] = true; - continue; - } - // Did this not even exist - or do we not have a label? if (!isset($tab_context['tabs'][$id])) $tab_context['tabs'][$id] = array('label' => $tab['label']); @@ -251,7 +241,7 @@ function template_generic_menu_tabs(&$menu_context) foreach ($tab_context['tabs'] as $sa => $tab) { - if (!empty($tab['disabled'])) + if (empty($tab['label'])) continue; if (!empty($tab['is_selected']))