You are here

public function AdminConfigure::submitForm in Image Lazyloader 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/AdminConfigure.php, line 59

Class

AdminConfigure
Class AdminConfigure.

Namespace

Drupal\lazyloader\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('lazyloader.configuration');
  foreach (Element::children($form) as $variable) {
    $config
      ->set($variable, $form_state
      ->getValue($form[$variable]['#parents']));
  }
  $config
    ->save();

  // Rebuild the theme registry if the module was enabled/disabled.
  if ($form['enabled']['#default_value'] !== $form_state
    ->getValue([
    'enabled',
  ])) {
    $this->themeRegistry
      ->reset();
  }
  parent::submitForm($form, $form_state);
}