function pwa_admin_configuration in Progressive Web App 7.2
Main configuration page for PWA.
1 string reference to 'pwa_admin_configuration'
- pwa_menu in ./
pwa.module - Implements hook_menu().
File
- ./
pwa.admin.inc, line 10 - PWA administration forms.
Code
function pwa_admin_configuration() {
// Reuse some fields from the manifest config form.
$manifest_form = pwa_admin_configuration_manifest();
$form['pwa_short_name'] = [
'#description' => t('Name of the shortcut created on the device. Should be like an app name (one short word or an acronym). You can configure the rest of the <a href="@manifest_url">manifest file values</a>.', [
'@manifest_url' => url('/admin/config/pwa/settings/manifest'),
]),
] + $manifest_form['pwa_short_name'];
$form['pwa_description'] = [
'#description' => t('A short description of the Progressive Web App. Required for inclusion in the <a href="@windows_pwa_url">Microsoft Store</a>.', [
'@windows_pwa_url' => 'https://docs.microsoft.com/en-us/microsoft-edge/progressive-web-apps-edgehtml/microsoft-store#criteria-for-automatic-submission',
]),
] + $manifest_form['pwa_description'];
$form['pwa_sw_cache_version'] = [
'#type' => 'textfield',
'#title' => t('Version'),
'#description' => t('Changing this number will invalidate caches for the manifest and serviceworker cache. Use it when assets have significantly changed or if you want to force a cache refresh for all clients.'),
'#size' => 5,
'#default_value' => variable_get('pwa_sw_cache_version', 1),
];
$form['pwa_sw_debug'] = [
'#type' => 'checkbox',
'#title' => t('Show debug messages'),
'#description' => t('Show all log messages from the serviceworker libraries.'),
'#default_value' => variable_get('pwa_sw_debug', FALSE),
];
// Apple specific configuration.
$form['pwa_apple_meta_enable'] = [
'#type' => 'checkbox',
'#title' => t('Improve Apple devices integration'),
'#description' => t('Let the PWA module add several non-standard metatags that help improve the PWA experience on Apple devices.'),
'#default_value' => variable_get('pwa_apple_meta_enable', TRUE),
];
$form['apple'] = [
'#type' => 'fieldset',
'#title' => t('Apple devices integration settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#states' => [
'invisible' => [
'[name="pwa_apple_meta_enable"]' => [
'checked' => FALSE,
],
],
],
];
$form['apple']['pwa_apple_status-bar-style'] = [
"#type" => 'select',
"#title" => t('Select color for status-bar-style'),
'#options' => [
'default' => t('Default'),
'black' => t('Black'),
'black_translucent' => t('Black translucent'),
],
'#default_value' => variable_get('pwa_apple_status-bar-style', 'black_translucent'),
];
$form['apple']['pwa_apple_startup-image'] = [
'#type' => 'checkbox',
'#title' => t('Enable startup splash screen'),
'#description' => t('The splash screen is generated automatically from the 512x512 image from the manifest. This will add 2 meta tags for each device selected.'),
'#default_value' => variable_get('pwa_apple_startup-image', TRUE),
];
$form['apple']['pwa_apple_startup-image_devices'] = [
'#type' => 'checkboxes',
'#title' => t('Splash screen for the following devices'),
'#description' => t('Two link tags in the html head will be generated for each device selected.'),
'#options' => array_column(_pwa_apple_devices(), 'device', 'device'),
'#states' => [
'visible' => [
'[name="pwa_apple_startup-image"]' => [
'checked' => TRUE,
],
],
],
'#default_value' => variable_get('pwa_apple_startup-image_devices', []),
];
$form = system_settings_form($form);
// Wait for all the values to be saved before refreshing cache.
$form['#submit'][] = 'pwa_admin_clear_cache';
$form['#submit'][] = 'pwa_admin_generate_drusplash';
return $form;
}