Elgg  Version 6.3
head.php
Go to the documentation of this file.
1 <?php
12 echo elgg_format_element('title', [], (string) elgg_extract('title', $vars), ['encode_text' => true]);
13 
14 $metas = elgg_extract('metas', $vars, []);
15 foreach ($metas as $attributes) {
16  echo elgg_format_element('meta', $attributes);
17 }
18 
19 $links = elgg_extract('links', $vars, []);
20 foreach ($links as $attributes) {
21  echo elgg_format_element('link', $attributes);
22 }
23 
24 echo elgg_view('page/elements/importmap.json');
25 
27 foreach ($js_foot as $resource) {
28  $options = [
29  'rel' => 'preload',
30  'as' => 'script',
31  'href' => $resource->url,
32  ];
33 
34  if (!empty($resource->integrity)) {
35  $options['integrity'] = $resource->integrity;
36  $options['crossorigin'] = 'anonymous';
37  }
38 
39  echo elgg_format_element('link', $options);
40 }
41 
43 foreach ($stylesheets as $name => $resource) {
44  $options = [
45  'data-name' => $name,
46  'rel' => 'stylesheet',
47  'href' => $resource->url,
48  ];
49 
50  if (!empty($resource->integrity)) {
51  $options['integrity'] = $resource->integrity;
52  $options['crossorigin'] = 'anonymous';
53  }
54 
55  echo elgg_format_element('link', $options);
56 }
57 
59 foreach ($js_head as $resource) {
60  $options = [
61  'src' => $resource->url,
62  ];
63 
64  if (!empty($resource->integrity)) {
65  $options['integrity'] = $resource->integrity;
66  $options['crossorigin'] = 'anonymous';
67  }
68 
69  echo elgg_format_element('script', $options);
70 }
71 
72 // See https://github.com/Elgg/Elgg/issues/8328
73 echo elgg_format_element('script', [], '// A non-empty script otherwise Firefox will exhibit FOUC');
74 
75 $imports = _elgg_services()->esm->getImports();
76 if (empty($imports)) {
77  return;
78 }
79 
80 ?>
81 <script type="module">
82 <?php
83 foreach ($imports as $module) {
84  echo "import '{$module}';" . PHP_EOL;
85 }
86 ?>
87 </script>
$vars
Definition: theme.php:3
if(! $user||! $user->canDelete()) $name
Definition: delete.php:22
$attributes
Elgg AJAX loader.
Definition: ajax_loader.php:10
if($who_can_change_language==='nobody') elseif($who_can_change_language==='admin_only' &&!elgg_is_admin_logged_in()) $options
Definition: language.php:20
$imports
Definition: head.php:75
foreach($js_foot as $resource) $stylesheets
Definition: head.php:42
$js_foot
Definition: head.php:26
$metas
The HTML head.
Definition: head.php:14
foreach($stylesheets as $name=> $resource) $js_head
Definition: head.php:58
foreach($metas as $attributes) $links
Definition: head.php:19
_elgg_services()
Get the global service provider.
Definition: elgglib.php:337
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:240
elgg_get_loaded_external_resources(string $type, string $location)
Get external resource descriptors.
elgg_view(string $view, array $vars=[], string $viewtype='')
Return a parsed view.
Definition: views.php:156
$module
Elgg login box.
Definition: login_box.php:8
$resource
elgg_format_element(string $tag_name, array $attributes=[], string $text='', array $options=[])
Format an HTML element.
Definition: output.php:145