You are here

public function SettingsForm::submitForm in Block List Override 1.0.x

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 203

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\block_list_override\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $settings = $this
    ->config('block_list_override.settings');
  $settings
    ->set('system_match', $form_state
    ->getValue('system_match'));
  $settings
    ->set('system_prefix', $form_state
    ->getValue('system_prefix'));
  $settings
    ->set('system_regex', $form_state
    ->getValue('system_regex'));
  $settings
    ->set('system_negate', $form_state
    ->getValue('system_negate'));
  $settings
    ->set('layout_match', $form_state
    ->getValue('layout_match'));
  $settings
    ->set('layout_prefix', $form_state
    ->getValue('layout_prefix'));
  $settings
    ->set('layout_regex', $form_state
    ->getValue('layout_regex'));
  $settings
    ->set('layout_negate', $form_state
    ->getValue('layout_negate'));
  $settings
    ->save();

  // Flush caches to be sure the system block list gets updated.
  drupal_flush_all_caches();
}