You are here

public function PluginConditionSettingsForm::submitForm in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Form/PluginConditionSettingsForm.php \Drupal\rng\Form\PluginConditionSettingsForm::submitForm()
  2. 3.x src/Form/PluginConditionSettingsForm.php \Drupal\rng\Form\PluginConditionSettingsForm::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 FormInterface::submitForm

File

src/Form/PluginConditionSettingsForm.php, line 90

Class

PluginConditionSettingsForm
Configure condition plugin settings.

Namespace

Drupal\rng\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValue('roles') as $role_id => $checked) {

    /** @var \Drupal\user\RoleInterface $role */
    $role = Role::load($role_id);
    $role
      ->setThirdPartySetting('rng', 'condition_rng_role', (bool) $checked)
      ->save();
  }
  $this->eventManager
    ->invalidateEventTypes();
  drupal_set_message(t('Updated condition plugin settings.'));
}