You are here

public function SettingsForm::submitForm in Config Distro 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

modules/config_distro_ignore/src/Form/SettingsForm.php, line 105

Class

SettingsForm
Provides a setting UI for Config Distro Ignore.

Namespace

Drupal\config_distro_ignore\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $settings = $this
    ->config('config_distro_ignore.settings');
  self::setArrayValueFromText($settings, $form_state, 'all_collections');
  self::setArrayValueFromText($settings, $form_state, 'default_collection');
  foreach ($this->distroStorage
    ->getAllCollectionNames() as $collection) {
    $key = 'custom_collections.' . $collection;
    self::setArrayValueFromText($settings, $form_state, $key);
  }
  $settings
    ->save();
  parent::submitForm($form, $form_state);

  // Clear the config_filter plugin cache.
  \Drupal::service('plugin.manager.config_filter')
    ->clearCachedDefinitions();
}