Elgg  Version 2.3
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' => elgg_extract_class($vars, 'elgg-comments'),
25 ];
26 
27 // work around for deprecation code in elgg_view()
28 unset($vars['internalid']);
29 
31  'type' => 'object',
32  'subtype' => 'comment',
33  'container_guid' => $vars['entity']->guid,
34  'reverse_order_by' => true,
35  'full_view' => true,
36  'limit' => $limit,
37  'preload_owners' => true,
38  'distinct' => false,
39  'url_fragment' => $attr['id'],
40 ));
41 
43  $content .= elgg_view_form('comment/save', array(), $vars);
44 }
45 
elgg_view_form($action, $form_vars=array(), $body_vars=array())
Definition: views.php:1345
$content
Definition: comments.php:30
elgg_extract_class(array $array, $existing=[])
Extract class names from an array with key "class", optionally merging into a preexisting set...
Definition: elgglib.php:1396
$vars['entity']
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:208
$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 echo
Translates a string.
Definition: languages.js:48
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Definition: elgglib.php:826
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:1375
elgg_list_entities(array $options=array(), $getter= 'elgg_get_entities', $viewer= 'elgg_view_entity_list')
Returns a string of rendered entities.
Definition: entities.php:393
$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