Exemplo n.º 1
0
 /**
  * Adds the configured context definitions from the config entity.
  *
  * Example: for a reaction rule config all context definitions of the event
  * will be added.
  *
  * @param \Drupal\Core\Config\Entity\ConfigEntityInterface $rules_config
  *   The config entity.
  *
  * @return $this
  */
 public function addContextDefinitionsFrom(ConfigEntityInterface $rules_config)
 {
     if ($rules_config instanceof ReactionRuleConfig) {
         $event_name = $rules_config->getEvent();
         // @todo Use setter injection for the service.
         $event_definition = \Drupal::service('plugin.manager.rules_event')->getDefinition($event_name);
         foreach ($event_definition['context'] as $context_name => $context_definition) {
             $this->addContextDefinition($context_name, $context_definition);
         }
     }
     return $this;
 }