You are here

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

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

Class

EventTypeRuleComponentEdit
Configure event settings.

Namespace

Drupal\rng\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->plugin
    ->submitConfigurationForm($form, $form_state);
  $configuration = $this->plugin
    ->getConfiguration();
  if ($this->componentType == 'condition') {
    $this->eventTypeRule
      ->setCondition($this->componentId, $configuration);
  }
  else {
    if ($this->componentType == 'action') {
      $this->eventTypeRule
        ->setAction($this->componentId, $configuration);
    }
  }
  $this->eventTypeRule
    ->save();
  $event_type = $this->eventManager
    ->eventType($this->eventTypeRule
    ->getEventEntityTypeId(), $this->eventTypeRule
    ->getEventBundle());
  $this->eventManager
    ->invalidateEventType($event_type);
}