function _pwa_apple_html_head_alter in Progressive Web App 7.2
Add apple specific variables.
1 call to _pwa_apple_html_head_alter()
- pwa_html_head_alter in ./
pwa.module - Implements hook_html_head_alter().
File
- includes/
pwa.apple.inc, line 114
Code
function _pwa_apple_html_head_alter(&$head_elements) {
$manifest = pwa_file_data('manifest');
// Icon used by Safari when the tab is pinned.
if ($mask_src = array_search('monochrome', array_column($manifest['icons'], 'purpose', 'src'))) {
// Add mask-icon
$head_elements['apple-mask-icon'] = [
'#type' => 'html_tag',
'#tag' => 'link',
'#attributes' => [
'rel' => 'mask-icon',
'href' => $mask_src,
'color' => $manifest['theme_color'],
],
'#weight' => 90,
];
}
// If the display does not give an 'app' feel, do not add apple metadata.
if (!in_array($manifest['display'], [
'standalone',
'fullscreen',
'minimal-ui',
])) {
return;
}
$head_elements['apple-mobile-web-app-capable'] = [
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => [
'name' => 'apple-mobile-web-app-capable',
'content' => 'yes',
],
'#weight' => 90,
];
$head_elements['apple-mobile-web-app-status-bar-style'] = [
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => [
'name' => 'apple-mobile-web-app-status-bar-style',
'content' => variable_get('pwa_apple_status-bar-style', 'black_translucent'),
],
'#weight' => 90,
];
// Many many images for the apple-touch-startup-image.
if (!variable_get('pwa_apple_startup-image', TRUE)) {
return;
}
foreach (_pwa_apple_drusplash_list() as $device => $icon) {
$head_elements['apple-touch-startup-image_' . $device] = [
'#type' => 'html_tag',
'#tag' => 'link',
'#attributes' => [
'rel' => 'apple-touch-startup-image',
] + $icon,
// Keep this lower in the HTML Source than the other meta tags.
'#weight' => 100,
];
}
}