From 946a4a008ab2bc3f3a530558ae47581f9d8fbbcb Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Wed, 24 Aug 2011 17:06:39 -0700 Subject: Refs #3750. Added annotation menu for generic comments (delete) and default annotations (empty). --- engine/lib/navigation.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'engine/lib/navigation.php') diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 1305ee3de..cefe40ecf 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -372,6 +372,31 @@ function elgg_entity_menu_setup($hook, $type, $return, $params) { return $return; } +/** + * Adds a delete link to "generic_comment" annotations + */ +function elgg_annotation_menu_setup($hook, $type, $return, $params) { + $annotation = $params['annotation']; + + if ($annotation->name == 'generic_comment' && $annotation->canEdit()) { + $url = elgg_http_add_url_query_elements('action/comments/delete', array( + 'annotation_id' => $annotation->id, + )); + + $options = array( + 'name' => 'delete', + 'href' => $url, + 'text' => "", + 'confirm' => elgg_echo('deleteconfirm'), + 'text_encode' => false + ); + $return[] = ElggMenuItem::factory($options); + } + + return $return; +} + + /** * Navigation initialization */ @@ -379,6 +404,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:annotation', 'elgg_annotation_menu_setup'); } elgg_register_event_handler('init', 'system', 'elgg_nav_init'); -- cgit v1.2.3