You are here

private function ContextFormBase::handleReactions in Context 8.0

Same name and namespace in other branches
  1. 8.4 modules/context_ui/src/Form/ContextFormBase.php \Drupal\context_ui\Form\ContextFormBase::handleReactions()
  2. 8 modules/context_ui/src/Form/ContextFormBase.php \Drupal\context_ui\Form\ContextFormBase::handleReactions()

Handle submitting the context reaction plugins configuration forms.

Parameters

array $form: The rendered form.

FormStateInterface $form_state: The current form state.

1 call to ContextFormBase::handleReactions()
ContextFormBase::submitForm in modules/context_ui/src/Form/ContextFormBase.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

modules/context_ui/src/Form/ContextFormBase.php, line 168

Class

ContextFormBase

Namespace

Drupal\context_ui\Form

Code

private function handleReactions(array &$form, FormStateInterface $form_state) {
  $reactions = $form_state
    ->getValue('reactions', []);

  // Loop trough each reaction and update the configuration values by
  // submitting the reactions form.
  foreach ($reactions as $reaction_id => $configuration) {
    $reaction = $this->entity
      ->getReaction($reaction_id);
    $reaction_values = (new FormState())
      ->setValues($configuration);
    $reaction
      ->submitConfigurationForm($form, $reaction_values);
  }
}