You are here

public function ModalPageSettingsForm::submitForm in Modal 8

Same name and namespace in other branches
  1. 8.3 src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::submitForm()
  2. 8.2 src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::submitForm()
  3. 5.0.x src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::submitForm()
  4. 4.0.x src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::submitForm()
  5. 4.1.x src/Form/ModalPageSettingsForm.php \Drupal\modal_page\Form\ModalPageSettingsForm::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/ModalPageSettingsForm.php, line 77

Class

ModalPageSettingsForm
Form for configure messages.

Namespace

Drupal\modal_page\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $array_values_modals = array_values(array_filter(explode(PHP_EOL, str_replace("\r", '', $form_state
    ->getValue('modal_page_modals')))));
  $array_values_modals_by_parameter = array_values(array_filter(explode(PHP_EOL, str_replace("\r", '', $form_state
    ->getValue('modal_page_modals_by_parameter')))));
  $modal_page_modals = implode(PHP_EOL, $array_values_modals);
  $modal_page_modals_by_parameter = implode(PHP_EOL, $array_values_modals_by_parameter);
  $config = $this
    ->config('modal_page.settings');
  $config
    ->set('modals', $modal_page_modals);
  $config
    ->set('modals_by_parameter', $modal_page_modals_by_parameter);
  $config
    ->save();
  drupal_flush_all_caches();
  parent::submitForm($form, $form_state);
}