aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-12-18 18:07:26 -0500
committercash <cash.costello@gmail.com>2011-12-18 18:07:26 -0500
commit96084b19f1caba6735afad6c89e7c0336e40c078 (patch)
treea2b21c8a2fde69bd0fee8f4df57f68189a13fa10 /engine
parentea3bf3b04410f56a52e8315bd636aeaf772a40a4 (diff)
parentbd5c0005158ca136fe87b34dacdf75491e69ed03 (diff)
downloadelgg-96084b19f1caba6735afad6c89e7c0336e40c078.tar.gz
elgg-96084b19f1caba6735afad6c89e7c0336e40c078.tar.bz2
Merge pull request #115 from hypeJunction/widgets_menu
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/navigation.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php
index 176790188..956ca220a 100644
--- a/engine/lib/navigation.php
+++ b/engine/lib/navigation.php
@@ -385,6 +385,55 @@ function elgg_entity_menu_setup($hook, $type, $return, $params) {
}
/**
+ * Widget menu is a set of widget controls
+ * @access private
+ */
+function elgg_widget_menu_setup($hook, $type, $return, $params) {
+
+ $widget = $params['entity'];
+ $show_edit = elgg_extract('show_edit', $params, true);
+
+ $collapse = array(
+ 'name' => 'collapse',
+ 'text' => ' ',
+ 'href' => "#elgg-widget-content-$widget->guid",
+ 'class' => 'elgg-widget-collapse-button',
+ 'rel' => 'toggle',
+ 'priority' => 1
+ );
+ $return[] = ElggMenuItem::factory($collapse);
+
+ if ($widget->canEdit()) {
+ $delete = array(
+ 'name' => 'delete',
+ 'text' => elgg_view_icon('delete-alt'),
+ 'title' => elgg_echo('widget:delete', array($widget->getTitle())),
+ 'href' => "action/widgets/delete?widget_guid=$widget->guid",
+ 'is_action' => true,
+ 'class' => 'elgg-widget-delete-button',
+ 'id' => "elgg-widget-delete-button-$widget->guid",
+ 'priority' => 900
+ );
+ $return[] = ElggMenuItem::factory($delete);
+
+ if ($show_edit) {
+ $edit = array(
+ 'name' => 'settings',
+ 'text' => elgg_view_icon('settings-alt'),
+ 'title' => elgg_echo('widget:edit'),
+ 'href' => "#widget-edit-$widget->guid",
+ 'class' => "elgg-widget-edit-button",
+ 'rel' => 'toggle',
+ 'priority' => 800,
+ );
+ $return[] = ElggMenuItem::factory($edit);
+ }
+ }
+
+ return $return;
+}
+
+/**
* Adds a delete link to "generic_comment" annotations
* @access private
*/
@@ -418,6 +467,7 @@ function elgg_nav_init() {
elgg_register_plugin_hook_handler('prepare', 'menu:site', 'elgg_site_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:river', 'elgg_river_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:entity', 'elgg_entity_menu_setup');
+ elgg_register_plugin_hook_handler('register', 'menu:widget', 'elgg_widget_menu_setup');
elgg_register_plugin_hook_handler('register', 'menu:annotation', 'elgg_annotation_menu_setup');
}