Elgg  Version 6.1
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");
$subtype
Definition: summary.php:34
$action
Definition: summary.php:32
elgg_get_excerpt(string $text, int $num_chars=250)
Returns an excerpt.
Definition: output.php:83
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
if(!$item instanceof ElggRiverItem) $subject
Definition: summary.php:13
elgg_get_page_owner_guid()
Elgg page owner library.
Definition: pageowner.php:12
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(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
elgg_language_key_exists(string $key, string $language= 'en')
Check if a given language key exists.
Definition: languages.php:44
$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
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:44
$vars
Definition: theme.php:5
if(!$owner instanceof ElggEntity) $summary
Definition: summary.php:33
getContainerEntity()
Get the container entity for this object.
Definition: ElggEntity.php:552
getURL()
Gets the URL for this entity.
Definition: ElggEntity.php:573
$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:1444
getDisplayName()
Get the entity&#39;s display name.
Definition: ElggEntity.php:306
$object_link
Definition: summary.php:25
$keys
Definition: summary.php:45