aboutsummaryrefslogtreecommitdiff
path: root/mod/blog
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-07 12:15:38 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-07 12:15:38 +0000
commit142aef30294caab47a184393103aa6644131ba19 (patch)
tree495f2308c99f76f2e33bdac26ceff4f0c9ff5496 /mod/blog
parent5991e7a915191a0d7655b51794dfdc1ac05ce5d7 (diff)
downloadelgg-142aef30294caab47a184393103aa6644131ba19.tar.gz
elgg-142aef30294caab47a184393103aa6644131ba19.tar.bz2
Refs #2895 entity menu uses new menu system
git-svn-id: http://code.elgg.org/elgg/trunk@8622 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/blog')
-rw-r--r--mod/blog/start.php31
-rw-r--r--mod/blog/views/default/object/blog.php13
2 files changed, 35 insertions, 9 deletions
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');
}
@@ -181,6 +184,34 @@ function blog_owner_block_menu($hook, $type, $return, $params) {
}
/**
+ * 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.
*/
function blog_ecml_views_hook($hook, $entity_type, $return_value, $params) {
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index a24d8758e..8c339236c 100644
--- a/mod/blog/views/default/object/blog.php
+++ b/mod/blog/views/default/object/blog.php
@@ -43,16 +43,11 @@ if ($blog->comments_on != 'Off') {
$comments_link = '';
}
-$extra_links = false;
-if ($blog->canEdit() && $blog->status != 'published') {
- $status_text = elgg_echo("blog:status:{$blog->status}");
- $extra_links = array($status_text);
-}
-
-$metadata = elgg_view('navigation/menu/metadata', array(
- 'entity' => $blog,
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
'handler' => 'blog',
- 'links' => $extra_links,
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
));
$subtitle = "<p>$author_text $date $comments_link</p>";