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 = (int) $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  'rel' => $mac,
19  'class' => 'elgg-menu elgg-menu-hover',
20  'data-menu-placeholder' => '1', // flag for the JS to know this menu isn't fully loaded yet
21  'data-elgg-menu-data' => json_encode([
22  'g' => $guid,
23  'pog' => $page_owner_guid,
24  'c' => $contexts,
25  'm' => $mac,
26  'i' => $input,
27  ]),
28 ]);
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['head']
Definition: html.php:24
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