From 142aef30294caab47a184393103aa6644131ba19 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 7 Mar 2011 12:15:38 +0000 Subject: Refs #2895 entity menu uses new menu system git-svn-id: http://code.elgg.org/elgg/trunk@8622 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/start.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'mod/blog/start.php') diff --git a/mod/blog/start.php b/mod/blog/start.php index 437970de4..344da21d4 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -63,6 +63,9 @@ function blog_init() { elgg_register_action('blog/auto_save_revision', "$action_path/auto_save_revision.php"); elgg_register_action('blog/delete', "$action_path/delete.php"); + // entity menu + elgg_register_plugin_hook_handler('register', 'menu:entity', 'blog_entity_menu_setup'); + // ecml elgg_register_plugin_hook_handler('get_views', 'ecml', 'blog_ecml_views_hook'); } @@ -180,6 +183,34 @@ function blog_owner_block_menu($hook, $type, $return, $params) { return $return; } +/** + * Add particular blog links/info to entity menu + */ +function blog_entity_menu_setup($hook, $type, $return, $params) { + if (elgg_in_context('widgets')) { + return $return; + } + + $entity = $params['entity']; + $handler = elgg_extract('handler', $params, false); + if ($handler != 'blog') { + return $return; + } + + if ($entity->canEdit() && $entity->status != 'published') { + $status_text = elgg_echo("blog:status:{$entity->status}"); + $options = array( + 'name' => 'published_status', + 'text' => $status_text, + 'href' => false, + 'priority' => 150, + ); + $return[] = ElggMenuItem::factory($options); + } + + return $return; +} + /** * Register blogs with ECML. */ -- cgit v1.2.3