Elgg  Version master
last_action.php
Go to the documentation of this file.
1 <?php
12 if (!$entity instanceof \ElggEntity) {
13  return;
14 }
15 
16 $format = elgg_extract('format', $vars, DATE_RFC2822);
17 
18 if ($format === 'friendly') {
19  echo elgg_view('output/friendlytime', [
20  'time' => $entity->last_action,
21  ]);
22  return;
23 }
24 
25 echo elgg_view('output/date', [
26  'value' => $entity->last_action,
27  'format' => $format,
28 ]);
$entity
Render the last action timestamp.
Definition: last_action.php:11
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(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
$vars
Definition: theme.php:5
if(!$entity instanceof\ElggEntity) $format
Definition: last_action.php:16