You are here

public function LazyForm::submitForm in Lazy-load 8

Same name and namespace in other branches
  1. 8.3 src/Form/LazyForm.php \Drupal\lazy\Form\LazyForm::submitForm()
  2. 8.2 src/Form/LazyForm.php \Drupal\lazy\Form\LazyForm::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

src/Form/LazyForm.php, line 194

Class

LazyForm
Configure Lazy settings for this site.

Namespace

Drupal\lazy\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('lazy.settings')
    ->set('alter_tag', $form_state
    ->getValue('alter_tag'))
    ->set('disabled_paths', $form_state
    ->getValue('disabled_paths'))
    ->set('errorClass', $form_state
    ->getValue('errorClass'))
    ->set('loadInvisible', (bool) $form_state
    ->getValue('loadInvisible'))
    ->set('offset', (int) $form_state
    ->getValue('offset'))
    ->set('saveViewportOffsetDelay', (int) $form_state
    ->getValue('saveViewportOffsetDelay'))
    ->set('selector', $form_state
    ->getValue('selector'))
    ->set('skipClass', $form_state
    ->getValue('skipClass'))
    ->set('src', $form_state
    ->getValue('src'))
    ->set('successClass', $form_state
    ->getValue('successClass'))
    ->set('validateDelay', $form_state
    ->getValue('validateDelay'))
    ->set('placeholderSrc', $form_state
    ->getValue('placeholderSrc'))
    ->save();
  parent::submitForm($form, $form_state);
  if ($form_state
    ->getValue('clear_cache')) {
    $this
      ->cacheClear();
  }
}