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