From c3f0a32b2bc8d055bfce97e20079cb7840746cd5 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 30 Oct 2010 20:30:16 +0000 Subject: pulled navigation functions out of elgglib.php git-svn-id: http://code.elgg.org/elgg/trunk@7136 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/navigation.php | 502 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 502 insertions(+) create mode 100644 engine/lib/navigation.php (limited to 'engine/lib/navigation.php') diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php new file mode 100644 index 000000000..a5b087bd8 --- /dev/null +++ b/engine/lib/navigation.php @@ -0,0 +1,502 @@ + $label, + 'href' => $link, + 'selected' => $selected + ); + + if (!$group) { + $group = 'default'; + } + + if ($onclick) { + $js = "onclick=\"javascript:return confirm('" . elgg_echo('deleteconfirm') . "')\""; + $item['vars'] = array('js' => $js); + } + // submenu items were added in the page setup hook usually by checking + // the context. We'll pass in the current context here, which will + // emulate that effect. + // if context == 'main' (default) it probably means they always wanted + // the menu item to show up everywhere. + $context = get_context(); + + if ($context == 'main') { + $context = 'all'; + } + return elgg_add_submenu_item($item, $context, $group); +} + +/** + * Add an entry to the submenu. + * + * @param array $item The item as: + * + * array( + * 'title' => 'Text to display', + * 'url' => 'URL of the link', + * 'id' => 'entry_unique_id' //used by children items to identify parents + * 'parent_id' => 'id_of_parent', + * 'selected' => BOOL // Is this item selected? (If NULL or unset will attempt to guess) + * 'vars' => array() // Array of vars to pass to the navigation/submenu_item view + * ) + * + * + * @param string $context Context in which to display this menu item. 'all' + * will make it show up all the time. Use sparingly. + * @param string $group Group for the item. Each submenu group has its own