/**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     parent::save($form, $form_state);
     // Also remove the temporarily stored rule, it has been persisted now.
     $this->deleteFromTempStore();
     // After the reaction rule is saved, we need to rebuild the container,
     // otherwise the reaction rule will not fire. However, we can do an
     // optimization: if our generic event subscriber is already registered to
     // the event in the kernel/container then we don't need to rebuild.
     if (!$this->isRuleEventRegistered()) {
         $this->drupalKernel->rebuildContainer();
     }
     drupal_set_message($this->t('Reaction rule %label has been updated.', ['%label' => $this->entity->label()]));
 }
 /**
  * {@inheritdoc}
  */
 public function delete(array $entities)
 {
     // After deleting a set of reaction rules, sometimes we may need to rebuild
     // the container, to clean it up, so that the generic subscriber is not
     // registered in the container for the rule events which we do not use
     // anymore. So we do that if there is any change in the registered events,
     // after the reaction rules are deleted.
     $events_before = $this->getRegisteredEvents();
     $return = parent::delete($entities);
     $events_after = $this->getRegisteredEvents();
     // Update the state of registered events and rebuild the container.
     if ($events_before != $events_after) {
         $this->stateService->set('rules.registered_events', $events_after);
         $this->drupalKernel->rebuildContainer();
     }
     return $return;
 }