Elgg  Version master
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 $resource) {
44  $options = [
45  'rel' => 'stylesheet',
46  'href' => $resource->url,
47  ];
48 
49  if (!empty($resource->integrity)) {
50  $options['integrity'] = $resource->integrity;
51  $options['crossorigin'] = 'anonymous';
52  }
53 
54  echo elgg_format_element('link', $options);
55 }
56 
58 foreach ($js_head as $resource) {
59  $options = [
60  'src' => $resource->url,
61  ];
62 
63  if (!empty($resource->integrity)) {
64  $options['integrity'] = $resource->integrity;
65  $options['crossorigin'] = 'anonymous';
66  }
67 
68  echo elgg_format_element('script', $options);
69 }
70 
71 // See https://github.com/Elgg/Elgg/issues/8328
72 echo elgg_format_element('script', [], '// A non-empty script otherwise Firefox will exhibit FOUC');
73 
74 $imports = _elgg_services()->esm->getImports();
75 if (empty($imports)) {
76  return;
77 }
78 
79 ?>
80 <script type="module">
81 <?php
82 foreach ($imports as $module) {
83  echo "import '{$module}';" . PHP_EOL;
84 }
85 ?>
86 </script>
foreach($metas as $attributes) $links
Definition: head.php:19
$module
Elgg login box.
Definition: login_box.php:8
$metas
The HTML head.
Definition: head.php:14
$js_foot
Definition: head.php:26
foreach($js_foot as $resource) $stylesheets
Definition: head.php:42
$resource
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
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
Definition: language.php:20
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
$vars
Definition: theme.php:5
foreach($stylesheets as $resource) $js_head
Definition: head.php:57
_elgg_services()
Get the global service provider.
Definition: elgglib.php:351
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
$imports
Definition: head.php:74