aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-27 14:20:22 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-27 14:20:22 +0000
commit4c94f8809f1131e2d8e073518195b6b65b26aceb (patch)
tree461af7e0e4414871c519acdef84ce397fa534325 /engine/lib
parent543e50d2aabfbd3c116cbb670018c66fae535955 (diff)
downloadelgg-4c94f8809f1131e2d8e073518195b6b65b26aceb.tar.gz
elgg-4c94f8809f1131e2d8e073518195b6b65b26aceb.tar.bz2
improved menu creation for on demand menus and integrated hover menu items into profile owner block
git-svn-id: http://code.elgg.org/elgg/trunk@7724 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/users.php16
-rw-r--r--engine/lib/views.php25
2 files changed, 24 insertions, 17 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 353575307..a87b241a2 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1493,17 +1493,17 @@ function elgg_user_hover_menu($hook, $type, $return, $params) {
$url = elgg_add_action_tokens_to_url($url);
$item = new ElggMenuItem('addfriend', $text, $url);
$item->setSection('action');
- elgg_register_menu_item('user_hover', $item);
+ $return[] = $item;
} else {
$url = "pg/profile/$user->username/edit";
$item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
$item->setSection('action');
- elgg_register_menu_item('user_hover', $item);
+ $return[] = $item;
$url = "pg/avatar/edit/$user->username";
$item = new ElggMenuItem('avatar:edit', elgg_echo('avatar:edit'), $url);
$item->setSection('action');
- elgg_register_menu_item('user_hover', $item);
+ $return[] = $item;
}
}
@@ -1532,14 +1532,16 @@ function elgg_user_hover_menu($hook, $type, $return, $params) {
$url = elgg_add_action_tokens_to_url($url);
$item = new ElggMenuItem($action, elgg_echo($action), $url);
$item->setSection('admin');
- elgg_register_menu_item('user_hover', $item);
+ $return[] = $item;
}
$url = "pg/profile/$user->username/edit";
$item = new ElggMenuItem('profile:edit', elgg_echo('profile:edit'), $url);
$item->setSection('admin');
- elgg_register_menu_item('user_hover', $item);
+ $return[] = $item;
}
+
+ return $return;
}
/**
@@ -1566,8 +1568,10 @@ function elgg_user_admin_menu($hook, $type, $return, $params) {
$url = "action/admin/user/$action?guid={$user->guid}";
$url = elgg_add_action_tokens_to_url($url);
$item = new ElggMenuItem($action, elgg_echo($action), $url);
- elgg_register_menu_item('user_admin', $item);
+ $return[] = $item;
}
+
+ return $return;
}
/**
diff --git a/engine/lib/views.php b/engine/lib/views.php
index 1e309f5bd..b5240b431 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -657,27 +657,30 @@ function elgg_view_layout($layout_name, $vars = array()) {
* @since 1.8.0
*/
function elgg_view_menu($menu_name, array $vars = array()) {
-
+ global $CONFIG;
+
$vars['name'] = $menu_name;
$sort_by = elgg_get_array_value('sort_by', $vars, 'title');
- // Give plugins a chance to add menu items just before creation.
- // This supports context sensitive menus (ex. user hover).
- elgg_trigger_plugin_hook('register', "menu:$menu_name", $vars, NULL);
+ $menu = $CONFIG->menus[$menu_name];
+
+ // Give plugins a chance to add menu items just before creation.
+ // This supports context sensitive menus (ex. user_hover).
+ $menu = elgg_trigger_plugin_hook('register', "menu:$menu_name", $vars, $menu);
- $builder = new ElggMenuBuilder($menu_name);
+ $builder = new ElggMenuBuilder($menu);
$vars['menu'] = $builder->getMenu($sort_by);
$vars['selected_item'] = $builder->getSelected();
// Let plugins modify the menu
- $vars['menu'] = elgg_trigger_plugin_hook('prepare', "menu:$menu_name", $vars, $vars['menu']);
+ $vars['menu'] = elgg_trigger_plugin_hook('prepare', "menu:$menu_name", $vars, $vars['menu']);
- if (elgg_view_exists("navigation/menu/$menu_name")) {
- return elgg_view("navigation/menu/$menu_name", $vars);
- } else {
- return elgg_view("navigation/menu/default", $vars);
- }
+ if (elgg_view_exists("navigation/menu/$menu_name")) {
+ return elgg_view("navigation/menu/$menu_name", $vars);
+ } else {
+ return elgg_view("navigation/menu/default", $vars);
+ }
}
/**