function _pwa_manifest_data in Progressive Web App 7
Generate the for the manifest file.
Return value
array
2 calls to _pwa_manifest_data()
- _pwa_manifest_file in ./
pwa.module - Generate JSON of the manifest data. This is the final file used by browsers.
- _pwa_serviceworker_file in ./
pwa.module - Take the serviceworker template file and replace all the variables needed.
File
- ./
pwa.module, line 120
Code
function _pwa_manifest_data() {
$path = drupal_get_path('module', 'pwa');
global $language;
$manifest = [
'name' => variable_get('pwa_name', variable_get('site_name')),
'short_name' => variable_get('pwa_short_name', variable_get('site_name')),
'description' => variable_get('pwa_description', ''),
'lang' => $language->language,
'dir' => $language->direction == LANGUAGE_LTR ? 'ltr' : 'rtl',
'background_color' => variable_get('pwa_background_color', '#ffffff'),
'theme_color' => variable_get('pwa_theme_color', '#ffffff'),
'start_url' => variable_get('pwa_start_url', '/'),
'orientation' => variable_get('pwa_orientation', 'portrait'),
'display' => variable_get('pwa_display', 'standalone'),
// Custom icons have to be defined in hook_pwa_manifest_alter().
//
// @see https://www.drupal.org/project/pwa/issues/2983031
// @see pwa.api.php
'icons' => [
[
'src' => url($path . '/assets/druplicon-512.png'),
'sizes' => '512x512',
'type' => 'image/png',
],
[
'src' => url($path . '/assets/druplicon-192.png'),
'sizes' => '192x192',
'type' => 'image/png',
],
[
'src' => url($path . '/assets/druplicon-144.png'),
'sizes' => '144x144',
'type' => 'image/png',
],
[
'src' => url($path . '/assets/druplicon-vector.svg'),
'type' => 'image/svg+xml',
],
],
];
drupal_alter('pwa_manifest', $manifest);
return $manifest;
}