You are here

protected static function SettingsForm::setArrayValueFromText in Config Distro 8

Set the settings from the form state and the key.

Parameters

\Drupal\Core\Config\Config $settings: The configuration to set the elements on.

\Drupal\Core\Form\FormStateInterface $form_state: The form state to get the data from.

string $key: The key to extract.

1 call to SettingsForm::setArrayValueFromText()
SettingsForm::submitForm in modules/config_distro_ignore/src/Form/SettingsForm.php
Form submission handler.

File

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

Class

SettingsForm
Provides a setting UI for Config Distro Ignore.

Namespace

Drupal\config_distro_ignore\Form

Code

protected static function setArrayValueFromText(Config &$settings, FormStateInterface $form_state, $key) {
  $values = $form_state
    ->getValue(strtr($key, [
    '.' => '_',
  ]));
  $values = preg_split("[\n|\r]", $values);
  $values = array_filter($values);
  $values = array_unique($values);
  sort($values);
  $settings
    ->set($key, $values);
}