diff options
Diffstat (limited to 'views/default/page/elements/comments.php')
-rw-r--r-- | views/default/page/elements/comments.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/views/default/page/elements/comments.php b/views/default/page/elements/comments.php new file mode 100644 index 000000000..c27a146ab --- /dev/null +++ b/views/default/page/elements/comments.php @@ -0,0 +1,30 @@ +<?php +/** + * List comments with optional add form + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['show_add_form'] Display add form or not + * @uses $vars['id'] Optional id for the div + */ + +$show_add_form = elgg_extract('show_add_form', $vars, true); + +$id = ''; +if (isset($vars['id'])) { + $id = "id =\"{$vars['id']}\""; +} + +echo "<div $id class=\"elgg-comments\">"; + +$options = array( + 'guid' => $vars['entity']->getGUID(), + 'annotation_name' => 'generic_comment' +); +echo elgg_list_annotations($options); + +if ($show_add_form) { + $form_vars = array('name' => 'elgg_add_comment'); + echo elgg_view_form('comments/add', $form_vars, $vars); +} + +echo '</div>'; |