Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
comments.php
Go to the documentation of this file.
1 <?php
15 $show_add_form = elgg_extract('show_add_form', $vars, true);
16 $full_view = elgg_extract('full_view', $vars, true);
17 $limit = elgg_extract('limit', $vars, get_input('limit', 0));
18 if (!$limit) {
19  $limit = elgg_trigger_plugin_hook('config', 'comments_per_page', [], 25);
20 }
21 
22 $attr = [
23  'id' => elgg_extract('id', $vars, 'comments'),
24  'class' => (array) elgg_extract('class', $vars, []),
25 ];
26 $attr['class'][] = 'elgg-comments';
27 
28 // work around for deprecation code in elgg_view()
29 unset($vars['internalid']);
30 
32  'type' => 'object',
33  'subtype' => 'comment',
34  'container_guid' => $vars['entity']->guid,
35  'reverse_order_by' => true,
36  'full_view' => true,
37  'limit' => $limit,
38  'preload_owners' => true,
39  'distinct' => false,
40  'url_fragment' => $attr['id'],
41 ));
42 
44  $content .= elgg_view_form('comment/save', array(), $vars);
45 }
46 
47 echo elgg_format_element('div', $attr, $content);
elgg_view_form($action, $form_vars=array(), $body_vars=array())
Definition: views.php:1302
$content
Definition: comments.php:31
$vars['entity']
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:218
$limit
Definition: comments.php:17
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Definition: elgglib.php:801
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1310
elgg_list_entities(array $options=array(), $getter= 'elgg_get_entities', $viewer= 'elgg_view_entity_list')
Returns a string of rendered entities.
Definition: entities.php:382
$full_view
Definition: comments.php:16
$show_add_form
List comments with optional add form.
Definition: comments.php:15
if(!$limit) $attr
Definition: comments.php:22