From dbdf001b867cb686beb6113d329eaa42b02ed4ca Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 27 Jan 2011 13:01:46 +0000 Subject: removed menu code introduced for elgg.com that did not make it into 1.8 git-svn-id: http://code.elgg.org/elgg/trunk@7949 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/navigation.php | 532 ++++++---------------------------------------- 1 file changed, 66 insertions(+), 466 deletions(-) (limited to 'engine/lib/navigation.php') diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index a6554fd99..155392645 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -72,9 +72,61 @@ function elgg_unregister_menu_item($menu_name, $item_name) { } /** - * Deprecated by elgg_add_submenu_item() + * Adds a breadcrumb to the breadcrumbs stack. + * + * @param string $title The title to display + * @param string $link Optional. The link for the title. + * + * @return void + * @since 1.8.0 + * + * @link http://docs.elgg.org/Tutorials/UI/Breadcrumbs + */ +function elgg_push_breadcrumb($title, $link = NULL) { + global $CONFIG; + if (!is_array($CONFIG->breadcrumbs)) { + $CONFIG->breadcrumbs = array(); + } + + // avoid key collisions. + $CONFIG->breadcrumbs[] = array('title' => $title, 'link' => $link); +} + +/** + * Removes last breadcrumb entry. + * + * @return array popped item. + * @since 1.8.0 + * @link http://docs.elgg.org/Tutorials/UI/Breadcrumbs + */ +function elgg_pop_breadcrumb() { + global $CONFIG; + + if (is_array($CONFIG->breadcrumbs)) { + array_pop($CONFIG->breadcrumbs); + } + + return FALSE; +} + +/** + * Returns all breadcrumbs as an array of array('title' => 'Readable Title', 'link' => 'URL') * - * @see elgg_add_submenu_item() + * @return array Breadcrumbs + * @since 1.8.0 + * @link http://docs.elgg.org/Tutorials/UI/Breadcrumbs + */ +function elgg_get_breadcrumbs() { + global $CONFIG; + + return (is_array($CONFIG->breadcrumbs)) ? $CONFIG->breadcrumbs : array(); +} + + +/** + * Deprecated by elgg_register_menu_item(). Set $menu_name to 'page'. + * + * @see elgg_register_menu_item() * @deprecated 1.8 * * @param string $label The label @@ -86,7 +138,7 @@ function elgg_unregister_menu_item($menu_name, $item_name) { * @return bool */ function add_submenu_item($label, $link, $group = 'default', $onclick = false, $selected = NULL) { - elgg_deprecated_notice('add_submenu_item was deprecated by elgg_add_submenu_item', 1.8); + elgg_deprecated_notice('add_submenu_item was deprecated by elgg_register_menu_item', 1.8); // submenu items were added in the page setup hook usually by checking // the context. We'll pass in the current context here, which will @@ -117,364 +169,22 @@ function add_submenu_item($label, $link, $group = 'default', $onclick = false, $ } return elgg_register_menu_item('page', $item); -/* - $item = array( - 'text' => $label, - 'href' => $link, - 'selected' => $selected - ); - - 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