Elgg  Version master
placeholder.php
Go to the documentation of this file.
1 <?php
2 
3 $user = elgg_extract('entity', $vars);
4 if (!$user instanceof \ElggUser) {
5  return;
6 }
7 
8 $guid = $user->guid;
11 $input = (array) elgg_get_config('input');
12 
13 // generate MAC so we don't have to trust the client's choice of contexts
15 $mac = elgg_build_hmac($data)->getToken();
16 
17 echo elgg_format_element('ul', [
18  'class' => ['elgg-menu', 'elgg-menu-hover'],
19  'data-menu-id' => $mac,
20  'data-elgg-menu-data' => json_encode([
21  'g' => $guid,
22  'pog' => $page_owner_guid,
23  'c' => $contexts,
24  'm' => $mac,
25  'i' => $input,
26  ]),
27 ]);
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
$page_owner_guid
Definition: placeholder.php:9
$data
Definition: placeholder.php:14
$contexts
Definition: placeholder.php:10
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:254
$input
Definition: placeholder.php:11
$user
Definition: placeholder.php:3
if(!$user instanceof\ElggUser) $guid
Definition: placeholder.php:8
$vars
Definition: theme.php:5
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
elgg_build_hmac($data)
Get an HMAC token builder/validator object.
Definition: actions.php:56
$mac
Definition: placeholder.php:15
elgg_get_context_stack()
Get the entire context stack (e.g.
Definition: context.php:88