Elgg  Version master
sidebar.php
Go to the documentation of this file.
1 <?php
8 $comment = elgg_extract('entity', $vars);
9 if (!$comment instanceof \ElggComment) {
10  return;
11 }
12 
13 $entity = $comment->getContainerEntity();
14 $commenter = $comment->getOwnerEntity();
15 if (!$entity instanceof \ElggEntity || !$commenter instanceof \ElggEntity) {
16  return;
17 }
18 
20 $excerpt = elgg_get_excerpt((string) $comment->description, 80);
22 
23 $body = elgg_format_element('span', ['class' => 'elgg-subtext'], "{$posted} ({$friendlytime}): {$excerpt}");
24 
if(!$entity instanceof\ElggEntity||!$commenter instanceof\ElggEntity) $friendlytime
Definition: sidebar.php:19
$excerpt
Definition: sidebar.php:20
$posted
Definition: sidebar.php:21
elgg_view_image_block(string $image, string $body, array $vars=[])
Wrapper function for the image block display pattern.
Definition: views.php:898
elgg_get_excerpt(string $text, int $num_chars=250)
Returns an excerpt.
Definition: output.php:83
$comment
Show a comment in the sidebar.
Definition: sidebar.php:8
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
elgg_view_entity_icon(\ElggEntity $entity, string $size= 'medium', array $vars=[])
View the icon of an entity.
Definition: views.php:542
elgg_view_friendly_time($time, $time_updated=null)
Displays a UNIX timestamp in a friendly way.
Definition: views.php:832
$vars
Definition: theme.php:5
$commenter
Definition: sidebar.php:14
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
$body
Definition: sidebar.php:23
elgg_view_entity_url(\ElggEntity $entity, array $options=[])
Helper function for outputting a link to an entity.
Definition: views.php:1444
if(!$comment instanceof\ElggComment) $entity
Definition: sidebar.php:13