Elgg  Version 5.1
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 
25 foreach ($js_foot as $resource) {
26  $options = [
27  'rel' => 'preload',
28  'as' => 'script',
29  'href' => $resource->url,
30  ];
31 
32  if (!empty($resource->integrity)) {
33  $options['integrity'] = $resource->integrity;
34  $options['crossorigin'] = 'anonymous';
35  }
36 
37  echo elgg_format_element('link', $options);
38 }
39 
41 foreach ($stylesheets as $resource) {
42  $options = [
43  'rel' => 'stylesheet',
44  'href' => $resource->url,
45  ];
46 
47  if (!empty($resource->integrity)) {
48  $options['integrity'] = $resource->integrity;
49  $options['crossorigin'] = 'anonymous';
50  }
51 
52  echo elgg_format_element('link', $options);
53 }
54 
56 foreach ($js_head as $resource) {
57  $options = [
58  'src' => $resource->url,
59  ];
60 
61  if (!empty($resource->integrity)) {
62  $options['integrity'] = $resource->integrity;
63  $options['crossorigin'] = 'anonymous';
64  }
65 
66  echo elgg_format_element('script', $options);
67 }
68 
69 // A non-empty script *must* come below the CSS links, otherwise Firefox will exhibit FOUC
70 // See https://github.com/Elgg/Elgg/issues/8328
71 ?>
72 <script>
73  <?php // Do not convert this to a regular function declaration. It gets redefined later. ?>
74  require = function () {
75  // handled in the view "elgg.js"
76  _require_queue.push(arguments);
77  };
79 </script>
foreach($metas as $attributes) $links
Definition: head.php:19
$metas
The HTML head.
Definition: head.php:14
foreach($js_foot as $resource) $stylesheets
Definition: head.php:40
$resource
_require_queue
Definition: head.php:78
$options
Elgg admin footer.
Definition: footer.php:6
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
foreach($links as $attributes) $js_foot
Definition: head.php:24
$vars
Definition: theme.php:5
foreach($stylesheets as $resource) $js_head
Definition: head.php:55
elgg_get_loaded_external_resources(string $type, string $location)
Get external resource descriptors.
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
$attributes
Elgg AJAX loader.
Definition: ajax_loader.php:10