function _pwa_manifest_file in Progressive Web App 7.2
Same name and namespace in other branches
- 7 pwa.module \_pwa_manifest_file()
Generate the for the manifest file.
Return value
array
File
- ./
pwa.module, line 250
Code
function _pwa_manifest_file() {
$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',
// Default to "Pale Gray" from the Drupal Brand Palette
// @see https://www.drupal.org/about/media-kit/logos
'background_color' => variable_get('pwa_background_color', '#F6F6F2'),
// Default to "Light blue" from the Drupal Brand Palette
// @see https://www.drupal.org/about/media-kit/logos
'theme_color' => variable_get('pwa_theme_color', '#53B0EB'),
'start_url' => variable_get('pwa_start_url', '/?source=pwa'),
'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' => file_create_url($path . '/assets/drupal-192.png'),
'sizes' => '192x192',
'type' => 'image/png',
'purpose' => 'any maskable',
],
[
'src' => file_create_url($path . '/assets/drupal-512.png'),
'sizes' => '512x512',
'type' => 'image/png',
'purpose' => 'any maskable',
],
[
'src' => file_create_url($path . '/assets/drupal.svg'),
'type' => 'image/svg+xml',
'sizes' => '512x512',
'purpose' => 'any maskable',
],
// Used for Apple-related icons.
[
'src' => file_create_url($path . '/assets/drupal-black.svg'),
'type' => 'image/svg+xml',
'sizes' => '16x16',
'purpose' => 'monochrome',
],
],
];
drupal_alter('pwa_manifest', $manifest);
return $manifest;
}