diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 |
commit | dccc333c765bb28da55b4a55d9c916acdb88413a (patch) | |
tree | bdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /mod/likes/start.php | |
parent | ec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff) | |
parent | 003cb81c7888f4d2fd763e5814027c6f8d71186f (diff) | |
download | elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2 |
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'mod/likes/start.php')
-rw-r--r-- | mod/likes/start.php | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/mod/likes/start.php b/mod/likes/start.php index b2aa83260..d45fb96b3 100644 --- a/mod/likes/start.php +++ b/mod/likes/start.php @@ -9,6 +9,7 @@ elgg_register_event_handler('init', 'system', 'likes_init'); function likes_init() { elgg_extend_view('css/elgg', 'likes/css'); + elgg_extend_view('js/elgg', 'likes/js'); // registered with priority < 500 so other plugins can remove likes elgg_register_plugin_hook_handler('register', 'menu:river', 'likes_river_menu_setup', 400); @@ -29,15 +30,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 +63,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); + } } } } |