Elgg  Version 4.3
AddMetasHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Page;
4 
11 
19  public function __invoke(\Elgg\Hook $hook) {
20  $head_params = $hook->getValue();
21 
22  $head_params['metas']['content-type'] = [
23  'http-equiv' => 'Content-Type',
24  'content' => 'text/html; charset=utf-8',
25  ];
26 
27  $head_params['metas']['description'] = [
28  'name' => 'description',
29  'content' => elgg_get_site_entity()->description,
30  ];
31 
32  // https://developer.chrome.com/multidevice/android/installtohomescreen
33  $head_params['metas']['viewport'] = [
34  'name' => 'viewport',
35  'content' => 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0',
36  ];
37 
38  $head_params['metas']['mobile-web-app-capable'] = [
39  'name' => 'mobile-web-app-capable',
40  'content' => 'yes',
41  ];
42 
43  $head_params['metas']['apple-mobile-web-app-capable'] = [
44  'name' => 'apple-mobile-web-app-capable',
45  'content' => 'yes',
46  ];
47 
48  return $head_params;
49  }
50 }
Add metas to page head.
Models an event passed to hook handlers.
Definition: Hook.php:11
elgg_get_site_entity()
Get the current site entity.
Definition: entities.php:99
__invoke(\Elgg\Hook $hook)
Add metas to HTML head.