From c94eb1a1cc386d58980357c63300e3479487f475 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 9 Jul 2008 16:59:00 +0000 Subject: Introducing the submenu git-svn-id: https://code.elgg.org/elgg/trunk@1371 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 51 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 722591ab4..d0ecc8bf4 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -481,10 +481,57 @@ */ function elgg_view_title($title) { - return elgg_view('page_elements/title', array('title' => $title)); + $title = elgg_view('page_elements/title', array('title' => $title)); + + return $title; + + } + + /** + * Adds an item to the submenu + * + * @param string $label The human-readable label + * @param string $link The URL of the submenu item + */ + function add_submenu_item($label, $link) { + + global $CONFIG; + add_to_register('submenu',$label,$link); + + } + + /** + * Gets a formatted list of submenu items + * + * @return string List of items + */ + function get_submenu() { + + $submenu = ""; + + if ($submenu_register = get_register('submenu')) { + foreach($submenu_register as $item) { + + if (substr_count($item->value, $item->value)) { + $selected = true; + } else { + $selected = false; + } + $submenu .= elgg_view('canvas_header/submenu_template', + array( + 'href' => $item->value, + 'label' => $item->name, + 'selected' => $selected, + )); + + } + } + + return $submenu; } + /** * Automatically views comments and a comment form relating to the given entity * @@ -778,7 +825,7 @@ global $CONFIG; - if (empty($register_name) || empty($subregister_name) || empty($children_array)) + if (empty($register_name) || empty($subregister_name)) return false; if (!isset($CONFIG->registers)) -- cgit v1.2.3