You are here

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

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

Class

EventAccessForm
Form to edit event access.

Namespace

Drupal\rng\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $component_operations = $form_state
    ->getValue('component_operations');
  foreach ($component_operations as $component_id => $operations) {
    $component = RuleComponent::load($component_id);
    $configuration = $component
      ->getConfiguration();
    foreach ($operations as $operation => $enabled) {
      $configuration['operations'][$operation] = $enabled;
    }
    $component
      ->setConfiguration($configuration)
      ->save();
  }
  Cache::invalidateTags($this->event
    ->getCacheTagsToInvalidate());
  drupal_set_message($this
    ->t('Updated access operations.'));
}