You are here

public function SettingsForm::submitForm in Critical CSS 8

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

src/Form/SettingsForm.php, line 110

Class

SettingsForm
Configuration form for critical css.

Namespace

Drupal\critical_css\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('critical_css.settings');
  $config
    ->set('enabled', $form_state
    ->getValue('critical_css_enabled'))
    ->set('enabled_for_logged_in_users', $form_state
    ->getValue('critical_css_enabled_for_logged_in_users'))
    ->set('preload_non_critical_css', $form_state
    ->getValue('critical_css_preload_non_critical_css'))
    ->set('dir_path', $form_state
    ->getValue('critical_css_dir_path'))
    ->set('excluded_ids', $form_state
    ->getValue('critical_css_excluded_ids'))
    ->save();
  parent::submitForm($form, $form_state);
}