Skip to content
Snippets Groups Projects
Commit 1b46d7fc authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #8614 by JonBob: better way to display menus.

parent d2ff1ca5
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -421,17 +421,17 @@ function theme_menu_item($mid) {
*/
function theme_menu_local_tasks() {
$active = true;
if ($mid = menu_get_active_nontask_item()) {
$menu = menu_get_menu();
$active_mid = $mid;
if ($children = $menu['items'][$mid]['children']) {
foreach ($menu['items'][$mid]['children'] as $cid) {
if (($menu['items'][$cid]['type'] & MENU_IS_LOCAL_TASK) && _menu_item_is_accessible($cid)) {
if (menu_in_active_trail($cid)) {
$tabs[] = theme('menu_local_task', $cid, TRUE);
$active = false;
$active_mid = $cid;
}
else {
$tabs[] = theme('menu_local_task', $cid, FALSE);
......@@ -442,13 +442,14 @@ function theme_menu_local_tasks() {
if ($tabs) {
// We add a default view-tab for the parent:
$output = "<ul class=\"tabs primary\">\n";
$output .= theme('menu_local_task', $mid, $active);
$output .= theme('menu_local_task', $mid, $active_mid == $mid);
$output .= implode($tabs);
$output .= "</ul>\n";
$output .= theme('menu_local_subtasks', $mid);
$output .= theme('menu_local_subtasks', $active_mid);
}
}
}
return $output;
}
......@@ -462,7 +463,7 @@ function theme_menu_local_tasks() {
*/
function theme_menu_local_task($mid, $active) {
if ($active) {
return '<li class="active">'. theme('menu_item', $mid) ."</li>\n";
return '<li class="active">'. theme('menu_item', $mid) ."</li>\n";
}
else {
return '<li>'. theme('menu_item', $mid) ."</li>\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment