Elgg  Version 1.11
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 $id = '';
23 if (isset($vars['id'])) {
24  $id = "id=\"{$vars['id']}\"";
25 } else {
26  $id = "id=\"comments\"";
27 }
28 
29 $class = 'elgg-comments';
30 if (isset($vars['class'])) {
31  $class = "$class {$vars['class']}";
32 }
33 
34 // work around for deprecation code in elgg_view()
35 unset($vars['internalid']);
36 
37 echo "<div $id class=\"$class\">";
38 
40  'type' => 'object',
41  'subtype' => 'comment',
42  'container_guid' => $vars['entity']->getGUID(),
43  'reverse_order_by' => true,
44  'full_view' => true,
45  'limit' => $limit,
46  'preload_owners' => true,
47  'distinct' => false,
48 ));
49 
50 echo $html;
51 
53  echo elgg_view_form('comment/save', array(), $vars);
54 }
55 
56 echo '</div>';
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$class
Definition: comments.php:29
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1246
$limit
Definition: comments.php:17
elgg echo
Translates a string.
Definition: languages.js:43
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Definition: elgglib.php:775
$html
Definition: comments.php:39
elgg_list_entities(array $options=array(), $getter= 'elgg_get_entities', $viewer= 'elgg_view_entity_list')
Returns a string of rendered entities.
Definition: entities.php:586
if(!$limit) $id
Definition: comments.php:22
$full_view
Definition: comments.php:16
$show_add_form
List comments with optional add form.
Definition: comments.php:15
elgg_view_form($action, $form_vars=array(), $body_vars=array())
Definition: views.php:1313
if(file_exists($welcome)) $vars
Definition: upgrade.php:93