From c7a2297071f81e121df0d8aa66ccdb70f8b7a989 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 22 Jan 2011 01:57:47 +0000 Subject: deprecated add_menu() and made it compatible with 1.8 git-svn-id: http://code.elgg.org/elgg/trunk@7892 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/navigation.php | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 773e6f25b..a6554fd99 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -484,29 +484,20 @@ function elgg_get_nav_items() { * * @param string $menu_name The name of the menu item * @param string $menu_url The URL of the page - * @param array $menu_children Optionally, an array of submenu items (not currently used) - * @param string $context The context of the menu + * @param array $menu_children Optionally, an array of submenu items (not used) + * @param string $context (not used) * * @return true|false Depending on success - * @todo Can be deprecated when the new menu system is introduced. + * @deprecated 1.8 use elgg_register_menu_item() for the menu 'site' */ function add_menu($menu_name, $menu_url, $menu_children = array(), $context = "") { - global $CONFIG; - - if (!isset($CONFIG->menucontexts)) { - $CONFIG->menucontexts = array(); - } - - if (empty($context)) { - $context = get_plugin_name(); - } - - $value = new stdClass(); - $value->url = elgg_normalize_url($menu_url); - $value->context = $context; + elgg_deprecated_notice('add_menu() deprecated by elgg_register_menu_item()', 1.8); - $CONFIG->menucontexts[] = $context; - return add_to_register('menu', $menu_name, $value, $menu_children); + return elgg_register_menu_item('site', array( + 'name' => $menu_name, + 'title' => $menu_name, + 'url' => $menu_url, + )); } /** -- cgit v1.2.3