Elgg  Version 3.0
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  ]);
23 
24  $object = $item->getObjectEntity();
25  if ($object) {
26  $metadata .= elgg_view_menu('social', [
27  'entity' => $object,
28  'item' => $item,
29  'class' => 'elgg-menu-hz',
30  ]);
31  }
32 }
33 
34 if (!empty($metadata)) {
35  echo elgg_format_element('div', [
36  'class' => 'elgg-river-metadata',
37  ], $metadata);
38 }
39 
40 // summary
42 if (!empty($timestamp)) {
43  $timestamp = elgg_format_element('span', ['class' => 'elgg-river-timestamp'], $timestamp);
44 }
45 
46 $summary = elgg_extract('summary', $vars);
47 if (!isset($summary)) {
48  $summary = elgg_view('river/elements/summary', $vars);
49 }
50 
51 if ($summary === false) {
52  $subject = $item->getSubjectEntity();
53  if ($subject instanceof ElggEntity) {
54  $summary = elgg_view('output/url', [
55  'href' => $subject->getURL(),
56  'text' => $subject->getDisplayName(),
57  'class' => 'elgg-river-subject',
58  'is_trusted' => true,
59  ]);
60  }
61 }
62 
63 $summary = trim("$summary $timestamp");
64 if (!empty($summary)) {
65  echo elgg_format_element('div', ['class' => 'elgg-river-summary'], $summary);
66 }
67 
68 // message (eg excerpt)
69 $message = elgg_extract('message', $vars);
70 if (!empty($message)) {
71  echo elgg_format_element('div', ['class' => 'elgg-river-message',], $message);
72 }
73 
74 // attachments
75 $attachments = elgg_extract('attachments', $vars);
76 if (!empty($attachments)) {
77  echo elgg_format_element('div', [
78  'class' => [
79  'elgg-river-attachments',
80  'clearfix',
81  ],
82  ], $attachments);
83 }
84 
85 // responses (eg. comments)
86 $responses = elgg_view('river/elements/responses', $vars);
87 if (!empty($responses)) {
88  echo elgg_format_element('div', ['class' => 'elgg-river-responses',], $responses);
89 }
if(!empty($attachments)) $responses
Definition: body.php:86
if(!$item instanceof ElggRiverItem) $object
Definition: responses.php:23
if(!($item instanceof\ElggRiverItem)) $metadata
Definition: body.php:18
if(!empty($summary)) $message
Definition: body.php:69
if(!isset($metadata)) if(!empty($metadata)) $timestamp
Definition: body.php:41
elgg_view_menu($menu, array $vars=[])
Render a menu.
Definition: views.php:755
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:168
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
$item
Body of river item.
Definition: body.php:12
$vars['type']
Definition: save.php:11
if(!empty($timestamp)) $summary
Definition: body.php:46
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246
elgg_view_friendly_time($time)
Displays a UNIX timestamp in a friendly way.
Definition: views.php:1120
$subject
Definition: useradd.php:59
if(!empty($message)) $attachments
Definition: body.php:75