From a2c9bf0f294758dc546adaf27120ba1880d2832a Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 25 Jun 2011 09:52:54 -0400 Subject: Fixes #3566 separate out likes button from likes count --- mod/likes/start.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'mod/likes/start.php') diff --git a/mod/likes/start.php b/mod/likes/start.php index b2aa83260..df1c7b109 100644 --- a/mod/likes/start.php +++ b/mod/likes/start.php @@ -29,15 +29,27 @@ function likes_entity_menu_setup($hook, $type, $return, $params) { $entity = $params['entity']; - // likes + // likes button $options = array( 'name' => 'likes', - 'text' => elgg_view('likes/display', array('entity' => $entity)), + 'text' => elgg_view('likes/button', array('entity' => $entity)), 'href' => false, 'priority' => 1000, ); $return[] = ElggMenuItem::factory($options); + // likes count + $count = elgg_view('likes/count', array('entity' => $entity)); + if ($count) { + $options = array( + 'name' => 'likes_count', + 'text' => $count, + 'href' => false, + 'priority' => 1001, + ); + $return[] = ElggMenuItem::factory($options); + } + return $return; } @@ -50,14 +62,27 @@ function likes_river_menu_setup($hook, $type, $return, $params) { $object = $item->getObjectEntity(); if (!elgg_in_context('widgets') && $item->annotation_id == 0) { if ($object->canAnnotate(0, 'likes')) { + // like button $options = array( 'name' => 'likes', 'href' => false, - 'text' => elgg_view('likes/display', array('entity' => $object)), + 'text' => elgg_view('likes/button', array('entity' => $object)), 'is_action' => true, 'priority' => 100, ); $return[] = ElggMenuItem::factory($options); + + // likes count + $count = elgg_view('likes/count', array('entity' => $object)); + if ($count) { + $options = array( + 'name' => 'likes_count', + 'text' => $count, + 'href' => false, + 'priority' => 101, + ); + $return[] = ElggMenuItem::factory($options); + } } } } -- cgit v1.2.3