Elgg  Version 6.1
body.php
Go to the documentation of this file.
1 <?php
13 if (!$item instanceof \ElggRiverItem) {
14  return;
15 }
16 
17 // metadata (eg. menus)
18 $metadata = elgg_extract('metadata', $vars);
19 if (!isset($metadata)) {
20  $metadata = elgg_view_menu('river', [
21  'item' => $item,
22  'prepare_dropdown' => true,
23  ]);
24 
25  $object = $item->getObjectEntity();
26  if ($object) {
27  $metadata .= elgg_view_menu('social', [
28  'entity' => $object,
29  'item' => $item,
30  'class' => 'elgg-menu-hz',
31  ]);
32  }
33 }
34 
35 if (!empty($metadata)) {
36  echo elgg_format_element('div', [
37  'class' => 'elgg-river-metadata',
38  ], $metadata);
39 }
40 
41 // summary
43 if (!empty($timestamp)) {
44  $timestamp = elgg_format_element('span', ['class' => 'elgg-river-timestamp'], $timestamp);
45 }
46 
47 $summary = elgg_extract('summary', $vars);
48 if (!isset($summary)) {
49  $summary = elgg_view('river/elements/summary', $vars);
50 }
51 
52 if ($summary === false) {
53  $subject = $item->getSubjectEntity();
54  if ($subject instanceof ElggEntity) {
55  $summary = elgg_view_entity_url($subject, ['class' => 'elgg-river-subject']);
56  }
57 }
58 
59 $summary = trim("$summary $timestamp");
60 if (!empty($summary)) {
61  echo elgg_format_element('div', ['class' => 'elgg-river-summary'], $summary);
62 }
63 
64 // message (eg excerpt)
65 $message = elgg_extract('message', $vars);
66 if (!empty($message)) {
67  echo elgg_format_element('div', ['class' => 'elgg-river-message'], $message);
68 }
69 
70 // attachments
71 $attachments = elgg_extract('attachments', $vars);
72 if (!empty($attachments)) {
73  echo elgg_format_element('div', ['class' => 'elgg-river-attachments'], $attachments);
74 }
75 
76 // responses (eg. comments)
77 $responses = elgg_view('river/elements/responses', $vars);
78 if (!empty($responses)) {
79  echo elgg_format_element('div', ['class' => 'elgg-river-responses',], $responses);
80 }
if(!$item instanceof\ElggRiverItem) $metadata
Definition: body.php:18
if(!isset($metadata)) if(!empty($metadata)) $timestamp
Definition: body.php:42
if(!empty($timestamp)) $summary
Definition: body.php:47
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:256
elgg_view_menu($menu, array $vars=[])
Render a menu.
Definition: views.php:441
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
if(!empty($message)) $attachments
Definition: body.php:71
if(!empty($attachments)) $responses
Definition: body.php:77
elgg_view_friendly_time($time, $time_updated=null)
Displays a UNIX timestamp in a friendly way.
Definition: views.php:832
if($email instanceof\Elgg\Email) $object
Definition: body.php:24
$vars
Definition: theme.php:5
$item
Body of river item.
Definition: body.php:12
$subject
HTML body of an email.
Definition: body.php:11
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
if(!empty($summary)) $message
Definition: body.php:65
elgg_view_entity_url(\ElggEntity $entity, array $options=[])
Helper function for outputting a link to an entity.
Definition: views.php:1444