You are here

public function SettingsForm::submitForm in Advanced CSS/JS Aggregation 8.2

Same name in this branch
  1. 8.2 src/Form/SettingsForm.php \Drupal\advagg\Form\SettingsForm::submitForm()
  2. 8.2 advagg_ext_minify/src/Form/SettingsForm.php \Drupal\advagg_ext_minify\Form\SettingsForm::submitForm()
  3. 8.2 advagg_mod/src/Form/SettingsForm.php \Drupal\advagg_mod\Form\SettingsForm::submitForm()
  4. 8.2 advagg_css_minify/src/Form/SettingsForm.php \Drupal\advagg_css_minify\Form\SettingsForm::submitForm()
  5. 8.2 advagg_js_minify/src/Form/SettingsForm.php \Drupal\advagg_js_minify\Form\SettingsForm::submitForm()
  6. 8.2 advagg_cdn/src/Form/SettingsForm.php \Drupal\advagg_cdn\Form\SettingsForm::submitForm()
  7. 8.2 advagg_bundler/src/Form/SettingsForm.php \Drupal\advagg_bundler\Form\SettingsForm::submitForm()
Same name and namespace in other branches
  1. 8.4 advagg_mod/src/Form/SettingsForm.php \Drupal\advagg_mod\Form\SettingsForm::submitForm()
  2. 8.3 advagg_mod/src/Form/SettingsForm.php \Drupal\advagg_mod\Form\SettingsForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ConfigFormBase::submitForm

File

advagg_mod/src/Form/SettingsForm.php, line 305

Class

SettingsForm
Configure advagg_mod settings for this site.

Namespace

Drupal\advagg_mod\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('advagg_mod.settings')
    ->set('css_adjust_sort_browsers', $form_state
    ->getValue('css_adjust_sort_browsers'))
    ->set('css_adjust_sort_external', $form_state
    ->getValue('css_adjust_sort_external'))
    ->set('css_defer', $form_state
    ->getValue('css_defer'))
    ->set('css_defer_admin', $form_state
    ->getValue('css_defer_admin'))
    ->set('css_defer_js_code', $form_state
    ->getValue('css_defer_js_code'))
    ->set('css_preprocess', $form_state
    ->getValue('css_preprocess'))
    ->set('css_translate', $form_state
    ->getValue('css_translate'))
    ->set('ga_inline_to_file', $form_state
    ->getValue('ga_inline_to_file'))
    ->set('js_adjust_sort_browsers', $form_state
    ->getValue('js_adjust_sort_browsers'))
    ->set('js_adjust_sort_external', $form_state
    ->getValue('js_adjust_sort_external'))
    ->set('js_async', $form_state
    ->getValue('js_async'))
    ->set('js_async_in_header', $form_state
    ->getValue('js_async_in_header'))
    ->set('js_defer', $form_state
    ->getValue('js_defer'))
    ->set('js_footer', $form_state
    ->getValue('js_footer'))
    ->set('js_preprocess', $form_state
    ->getValue('js_preprocess'))
    ->set('prefetch', $form_state
    ->getValue('prefetch'))
    ->set('unified_multisite_dir', $form_state
    ->getValue('unified_multisite_dir'))
    ->save();

  // Clear relevant caches.
  $this->cssCollectionOptimizer
    ->deleteAll();
  $this->jsCollectionOptimizer
    ->deleteAll();
  Cache::invalidateTags([
    'library_info',
    'advagg_css',
    'advagg_js',
  ]);
  parent::submitForm($form, $form_state);
}