You are here

public function Settings::submitForm in Config Ignore 8.3

Same name and namespace in other branches
  1. 8 src/Form/Settings.php \Drupal\config_ignore\Form\Settings::submitForm()
  2. 8.2 src/Form/Settings.php \Drupal\config_ignore\Form\Settings::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/Settings.php, line 63

Class

Settings
Provides a setting UI for Config Ignore.

Namespace

Drupal\config_ignore\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config_ignore_settings = $this
    ->config('config_ignore.settings');

  // Normalize the text to Unix line endings.
  $ignored_config_entities = str_replace("\r", "\n", $form_state
    ->getValue('ignored_config_entities'));
  $config_ignore_settings_array = array_values(array_filter(array_map('trim', explode("\n", $ignored_config_entities))));
  $config_ignore_settings
    ->set('ignored_config_entities', $config_ignore_settings_array);
  $config_ignore_settings
    ->save();
  parent::submitForm($form, $form_state);
}