diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-21 02:14:06 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-21 02:14:06 +0000 |
commit | d8e7579df3f89587f1a43b64d9bd9a76b6842d5e (patch) | |
tree | cb610e400a5a4d47d2ad9a44f7942dc95fcd02e4 /views | |
parent | 7f4e7c8a0a9bf500f9c888fc49aece9644fee8fd (diff) | |
download | elgg-d8e7579df3f89587f1a43b64d9bd9a76b6842d5e.tar.gz elgg-d8e7579df3f89587f1a43b64d9bd9a76b6842d5e.tar.bz2 |
Refs #2090 removed elgg_view_latest_comments() and replaced it with a page elements view
git-svn-id: http://code.elgg.org/elgg/trunk@8801 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views')
-rw-r--r-- | views/default/page/elements/comments.php | 2 | ||||
-rw-r--r-- | views/default/page/elements/comments_block.php | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/views/default/page/elements/comments.php b/views/default/page/elements/comments.php index 1b0082ee4..ebc7d3df5 100644 --- a/views/default/page/elements/comments.php +++ b/views/default/page/elements/comments.php @@ -31,7 +31,7 @@ $options = array( ); $html = elgg_list_annotations($options); if ($html) { - echo '<h3>Comments</h3>'; + echo '<h3>' . elgg_echo('comments') . '</h3>'; echo $html; } diff --git a/views/default/page/elements/comments_block.php b/views/default/page/elements/comments_block.php new file mode 100644 index 000000000..89e43b266 --- /dev/null +++ b/views/default/page/elements/comments_block.php @@ -0,0 +1,33 @@ +<?php +/** + * Display the latest related comments + * + * Generally used in a sidebar + * + * @uses $vars['subtypes'] Object subtype string or array of subtypes + * @uses $vars['owner_guid'] The owner of the content being commented on + * @uses $vars['limit'] The number of comments to display + */ + +$options = array( + 'annotation_name' => 'generic_comment', + 'owner_guid' => elgg_extract('owner_guid', $vars, ELGG_ENTITIES_ANY_VALUE), + 'reverse_order_by' => true, + 'limit' => elgg_extract('limit', $vars, 4), + 'type' => 'object', + 'subtypes' => elgg_extract('subtypes', $vars, ELGG_ENTITIES_ANY_VALUE), +); + +$title = elgg_echo('generic_comments:latest'); +$comments = elgg_get_annotations($options); +if ($comments) { + $body = elgg_view('page/components/list', array( + 'items' => $comments, + 'pagination' => false, + 'list_class' => 'elgg-latest-comments', + )); +} else { + $body = '<p>' . elgg_echo('generic_comment:none') . '</p>'; +} + +echo elgg_view_module('aside', $title, $body); |