diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-09-28 17:53:04 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-09-28 17:53:04 +0000 |
commit | 32e8d77cd6872b98f5fe00f35b6d124a28a977f0 (patch) | |
tree | e34ba4b39c6db6f62f1c1a237e0d4dcc682f3028 /includes | |
parent | b8416f613a0db27c63aa92321a5cb537beb46c54 (diff) | |
download | brdo-32e8d77cd6872b98f5fe00f35b6d124a28a977f0.tar.gz brdo-32e8d77cd6872b98f5fe00f35b6d124a28a977f0.tar.bz2 |
- Associate a callback with the menu links! (This callback is not yet being
called but will be as soon the remaining links have been transformed to use
the menu system.)
- Made sure the menu does not render links with no callback and no children.
Like this, the 'create content' link is not being shown when the user has
no permission to add any content.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/menu.inc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/includes/menu.inc b/includes/menu.inc index 7449dc3f7..4679a5dac 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -133,7 +133,12 @@ function menu_tree($parent = "") { $output = "\n<ul>\n"; usort($_list[$parent]["children"], "_menu_sort"); foreach ($_list[$parent]["children"] as $item) { - if ($_list[$item]["hidden"] == 0) { + /* + ** Don't render the menu when it is hidden, or when it has no call-back + ** nor children. The latter check avoids that useless links are being + ** rendered. + */ + if ($_list[$item]["hidden"] == 0 && ($_list[$item]["callback"] || $_list[$item]["children"])) { $style = ($_list[$item]["children"] ? (menu_in_active_trail($item) ? "expanded" : "collapsed") : "leaf"); $output .= "<li class=\"$style\">"; $output .= _render_item($item); |