Elgg  Version 3.0
time_created.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->time_created,
21  ]);
22  return;
23 }
24 
25 echo elgg_view('output/date', [
26  'value' => $entity->time_created,
27  'format' => $format,
28 ]);
$entity
Render the time created.
elgg echo
Translates a string.
Definition: languages.js:43
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:1131
if(!$entity instanceof ElggEntity) $format
$vars['type']
Definition: save.php:11
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246