Elgg  Version 4.x
summary.php
Go to the documentation of this file.
1 <?php
8 $item = elgg_extract('item', $vars);
9 if (!$item instanceof ElggRiverItem) {
10  return;
11 }
12 
13 $subject = $item->getSubjectEntity();
14 if (!$subject instanceof ElggEntity) {
15  return;
16 }
17 
18 $object = $item->getObjectEntity();
19 if (!$object instanceof ElggEntity) {
20  return;
21 }
22 
23 $subject_link = elgg_view_entity_url($subject, ['class' => 'elgg-river-subject']);
24 
25 $object_link = elgg_view('output/url', [
26  'href' => $object->getURL(),
27  'text' => elgg_get_excerpt($object->getDisplayName(), 100),
28  'class' => 'elgg-river-object',
29  'is_trusted' => true,
30 ]);
31 
32 $action = $item->action_type;
33 $type = $item->type;
34 $subtype = $item->subtype;
35 
36 // if activity happened in a group
39 if ($container instanceof ElggGroup && $container->guid != elgg_get_page_owner_guid()) {
41 }
42 
43 // check summary translation keys
44 $key = false;
45 $keys = [
46  "river:{$type}:{$subtype}:{$action}",
47  "river:{$type}:{$subtype}:default",
48  "river:{$type}:{$action}",
49  "river:{$type}:default",
50 ];
51 foreach ($keys as $try_key) {
52  if (elgg_language_key_exists($try_key)) {
53  $key = $try_key;
54  break;
55  }
56 }
57 
58 $summary = '';
59 if ($key !== false) {
61 }
62 
63 echo trim("$summary $group_string");
elgg_language_key_exists($key, $language= 'en')
Check if a given language key exists.
Definition: languages.php:61
$subtype
Definition: summary.php:34
$action
Definition: summary.php:32
if(!$item instanceof ElggRiverItem) $subject
Definition: summary.php:13
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
elgg_get_page_owner_guid()
Elgg page owner library.
Definition: pageowner.php:12
$type
Definition: summary.php:33
if(!$object instanceof ElggEntity) $subject_link
Definition: summary.php:23
$container
Definition: summary.php:38
$group_string
Definition: summary.php:37
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:686
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:44
elgg_get_excerpt($text, $num_chars=250)
Returns an excerpt.
Definition: output.php:71
if(!$owner instanceof ElggEntity) $summary
Definition: summary.php:33
elgg echo
Translates a string.
Definition: deprecated.js:530
$vars['head']
Definition: html.php:24
getContainerEntity()
Get the container entity for this object.
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:205
getURL()
Gets the URL for this entity.
$item
Short summary of the action that occurred.
Definition: summary.php:8
if(!$subject instanceof ElggEntity) $object
Definition: summary.php:18
elgg_view_entity_url(\ElggEntity $entity, array $options=[])
Helper function for outputting a link to an entity.
Definition: views.php:2056
getDisplayName()
Get the entity&#39;s display name.
Definition: ElggEntity.php:318
$object_link
Definition: summary.php:25
$keys
Definition: summary.php:45