You are here

function pwa_admin_configuration_sw_precache in Progressive Web App 7.2

1 string reference to 'pwa_admin_configuration_sw_precache'
pwa_menu in ./pwa.module
Implements hook_menu().

File

./pwa.admin.inc, line 374
PWA administration forms.

Code

function pwa_admin_configuration_sw_precache() {
  $form = [];
  $form['intro'] = [
    '#markup' => '<p>' . t('Use cautiously, precached files and pages will always be served from the cache, even if they are updated on the website.') . '</p>',
  ];
  $form['pwa_sw_precache_page'] = [
    '#type' => 'textarea',
    '#title' => t('Precache pages'),
    '#description' => t('Relative URLs. Pages acessible offline even if the user did not visit them. The offline page is added by default. List of pages that will be loaded on serviceworker installation. Only set pages that do not change frequently, page assets are not automatically saved.'),
    '#default_value' => variable_get('pwa_sw_precache_page', '/offline'),
  ];
  $form['pwa_sw_precache_asset'] = [
    '#type' => 'textarea',
    '#title' => t('Precache assets'),
    '#description' => t('Relative URLs. List of files that will be loaded on serviceworker installation. The files should not change much, like logos, fonts, icons, etc.'),
    '#default_value' => variable_get('pwa_sw_precache_asset', ''),
  ];
  $form = system_settings_form($form);

  // Wait for all the values to be saved before refreshing cache.
  $form['#submit'][] = 'pwa_admin_clear_cache';
  return $form;
}