Elgg  Version 2.3
by_line.php
Go to the documentation of this file.
1 <?php
2 
3 $entity = elgg_extract('entity', $vars);
4 if (!($entity instanceof ElggEntity)) {
5  return;
6 }
7 
8 $by_line = [];
9 
10 $owner = $entity->getOwnerEntity();
11 if ($owner instanceof ElggEntity) {
12  $owner_url = elgg_extract('owner_url', $vars, $owner->getURL());
13 
14  $owner_link = elgg_view('output/url', [
15  'href' => $owner_url,
16  'text' => $owner->name,
17  'is_trusted' => true,
18  ]);
19 
20  $by_line[] = elgg_echo('byline', array($owner_link));
21 }
22 
24 
25 $container_entity = $entity->getContainerEntity();
26 if ($container_entity instanceof ElggGroup && ($container_entity->getGUID() !== elgg_get_page_owner_guid())) {
27  $group_link = elgg_view('output/url', [
28  'href' => $container_entity->getURL(),
29  'text' => $container_entity->name,
30  'is_trusted' => true,
31  ]);
32  $by_line[] = elgg_echo("byline:ingroup", [$group_link]);
33 }
34 
35 if (!empty($by_line)) {
36  echo implode(' ', $by_line);
37 }
$container_entity
Definition: by_line.php:25
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$vars['entity']
$owner_link
Definition: default.php:17
$entity
Definition: by_line.php:3
$owner
Definition: by_line.php:10
elgg echo
Translates a string.
Definition: languages.js:48
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
if(!($entity instanceof ElggEntity)) $by_line
Definition: by_line.php:8
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:1375
elgg_get_page_owner_guid($guid=0)
Gets the guid of the entity that owns the current page.
Definition: pageowner.php:22
elgg_view_friendly_time($time)
Displays a UNIX timestamp in a friendly way.
Definition: views.php:1176