From 928c113b82833cd1f1dfbe42f813ed3547b9ede7 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 17 Dec 2003 22:15:35 +0000 Subject: [PATCH] Patch by Kjartan: - Adds possibility to hide menu item when it has no children. (Fixes the node/add problem when user doesn't have access to create any node types.) - More doxygen comments. --- includes/menu.inc | 39 +++++++++++++++++++++++++++++++++------ modules/node.module | 2 +- modules/node/node.module | 2 +- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/includes/menu.inc b/includes/menu.inc index e3e617e0281..c2d932b6478 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1,10 +1,32 @@ "; $output .= _render_item($item); @@ -171,12 +198,12 @@ function menu_tree($parent = "", $hidden = 0) { } $output .= "\n"; } - else if ($_list[$item]["hidden"] == 1 && $_list[$item]["children"]) { + else if ($_list[$item]["hidden"] == MENU_HIDE && $_list[$item]["children"]) { $output .= menu_tree($item, 1); } } - if ($output != '' && $hidden != 1) { + if ($output != '' && $hidden != MENU_HIDE) { $output = "\n\n"; } } diff --git a/modules/node.module b/modules/node.module index 1fdba9d0aec..684f7dca7b0 100644 --- a/modules/node.module +++ b/modules/node.module @@ -575,7 +575,7 @@ function node_link($type, $node = 0, $main = 0) { } if ($type == "system") { - menu("node/add", t("create content"), NULL, 1); + menu("node/add", t("create content"), 'node_page', 1, MENU_HIDE_NOCHILD); if (user_access("administer nodes")) { menu("admin/node", t("content"), "node_admin"); diff --git a/modules/node/node.module b/modules/node/node.module index 1fdba9d0aec..684f7dca7b0 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -575,7 +575,7 @@ function node_link($type, $node = 0, $main = 0) { } if ($type == "system") { - menu("node/add", t("create content"), NULL, 1); + menu("node/add", t("create content"), 'node_page', 1, MENU_HIDE_NOCHILD); if (user_access("administer nodes")) { menu("admin/node", t("content"), "node_admin");