Elgg  Version 6.1
metadata.php
Go to the documentation of this file.
1 <?php
11 $metadata = elgg_extract('metadata', $vars);
12 if (!isset($metadata)) {
13  $metadata = '';
14 
15  $entity = elgg_extract('entity', $vars);
16  $show_entity_menu_default = true;
17  if ($entity instanceof \ElggEntity) {
18  $entity_url = $entity->getURL();
19  if (!empty($entity_url) && stripos(elgg_get_current_url(), $entity_url) !== false) {
20  // probably on a full view of an entity
21  $show_entity_menu_default = false;
22  }
23  }
24 
25  $show_entity_menu = elgg_extract('show_entity_menu', $vars, $show_entity_menu_default);
26  $show_social_menu = elgg_extract('show_social_menu', $vars, true);
27 
28  if ($show_entity_menu) {
29  $metadata .= elgg_view_menu('entity', [
30  'entity' => $entity,
31  'handler' => elgg_extract('handler', $vars),
32  'prepare_dropdown' => true,
33  ]);
34  }
35 
36  if ($show_social_menu && !elgg_in_context('admin')) {
37  $metadata .= elgg_view_menu('social', [
38  'entity' => $entity,
39  'handler' => elgg_extract('handler', $vars),
40  'class' => 'elgg-menu-hz',
41  ]);
42  }
43 }
44 
45 if (!$metadata) {
46  return;
47 }
48 
49 echo elgg_format_element('div', [
50  'class' => [
51  'elgg-listing-summary-metadata',
52  ]
53 ], $metadata);
elgg_in_context(string $context)
Check if this context exists anywhere in the stack.
Definition: context.php:78
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
$entity
Definition: reset.php:8
elgg_get_current_url()
Returns the current page&#39;s complete URL.
$vars
Definition: theme.php:5
$metadata
Output annotation metadata.
Definition: metadata.php:9
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145