You are here

public function SettingsForm::submitForm in Drupal 8

Same name in this branch
  1. 8 core/modules/media_library/src/Form/SettingsForm.php \Drupal\media_library\Form\SettingsForm::submitForm()
  2. 8 core/modules/aggregator/src/Form/SettingsForm.php \Drupal\aggregator\Form\SettingsForm::submitForm()
Same name and namespace in other branches
  1. 9 core/modules/aggregator/src/Form/SettingsForm.php \Drupal\aggregator\Form\SettingsForm::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

core/modules/aggregator/src/Form/SettingsForm.php, line 206

Class

SettingsForm
Configures aggregator settings for this site.

Namespace

Drupal\aggregator\Form

Code

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

  // Let active plugins save their settings.
  foreach ($this->configurableInstances as $instance) {
    $instance
      ->submitConfigurationForm($form, $form_state);
  }
  $config
    ->set('items.allowed_html', $form_state
    ->getValue('aggregator_allowed_html_tags'));
  if ($form_state
    ->hasValue('aggregator_fetcher')) {
    $config
      ->set('fetcher', $form_state
      ->getValue('aggregator_fetcher'));
  }
  if ($form_state
    ->hasValue('aggregator_parser')) {
    $config
      ->set('parser', $form_state
      ->getValue('aggregator_parser'));
  }
  if ($form_state
    ->hasValue('aggregator_processors')) {
    $config
      ->set('processors', array_filter($form_state
      ->getValue('aggregator_processors')));
  }
  $config
    ->save();
}