You are here

public function RngSettingsForm::submitForm in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 8 src/Form/RngSettingsForm.php \Drupal\rng\Form\RngSettingsForm::submitForm()
  2. 3.x src/Form/RngSettingsForm.php \Drupal\rng\Form\RngSettingsForm::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/RngSettingsForm.php, line 123

Class

RngSettingsForm
Configure primary RNG settings.

Namespace

Drupal\rng\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $identity_types = [];
  foreach ($form_state
    ->getValue('contactables') as $entity_type => $enabled) {
    if ($enabled) {
      $identity_types[] = $entity_type;
    }
  }
  $config = $this
    ->config('rng.settings');
  $config
    ->set('identity_types', $identity_types);
  $config
    ->save();
  drupal_set_message(t('RNG settings updated.'));
}