Ejemplo n.º 1
0
 /**
  * Constructs a new class instance.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  *   Contains the following entries:
  *   - condition_id: The condition plugin ID.
  * @param string $plugin_id
  *   The plugin ID for the plugin instance.
  * @param mixed $plugin_definition
  *   The plugin implementation definition.
  * @param \Drupal\Core\Condition\ConditionManager $conditionManager
  *   The condition manager.
  * @param \Drupal\rules\Context\DataProcessorManager $processor_manager
  *   The data processor plugin manager.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, ConditionManager $conditionManager, DataProcessorManager $processor_manager)
 {
     // Make sure defaults are applied.
     $configuration += $this->defaultConfiguration();
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->conditionManager = $conditionManager;
     $this->processorManager = $processor_manager;
 }
Ejemplo n.º 2
0
 /**
  * Constructs a new class instance.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  * @param string $plugin_id
  *   The plugin_id for the plugin instance.
  * @param array $plugin_definition
  *   The plugin implementation definition.
  * @param \Drupal\rules\Engine\ExpressionManagerInterface $expression_manager
  *   The rules expression plugin manager.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, ExpressionManagerInterface $expression_manager)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->expressionManager = $expression_manager;
     $configuration += ['actions' => []];
     foreach ($configuration['actions'] as $action_config) {
         $action = $expression_manager->createInstance($action_config['id'], $action_config);
         $this->addExpressionObject($action);
     }
 }
Ejemplo n.º 3
0
 /**
  * Constructs a new class instance.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  * @param string $plugin_id
  *   The plugin_id for the plugin instance.
  * @param array $plugin_definition
  *   The plugin implementation definition.
  * @param \Drupal\rules\Engine\ExpressionManagerInterface $expression_manager
  *   The rules expression plugin manager.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, ExpressionManagerInterface $expression_manager)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $configuration += ['conditions' => [], 'actions' => []];
     // Per default the outer condition container of a rule is initialized as
     // conjunction (AND), meaning that all conditions in it must evaluate to
     // TRUE to fire the actions.
     $this->conditions = $expression_manager->createInstance('rules_and', $configuration['conditions']);
     $this->actions = $expression_manager->createInstance('rules_action_set', $configuration['actions']);
 }
 /**
  * Constructs a new class instance.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  * @param string $plugin_id
  *   The plugin_id for the plugin instance.
  * @param array $plugin_definition
  *   The plugin implementation definition.
  * @param \Drupal\rules\Engine\ExpressionManagerInterface $expression_manager
  *   The rules expression plugin manager.
  * @param \Drupal\Component\Uuid\UuidInterface $uuid_service
  *   The UUID generating service.
  */
 public function __construct(array $configuration, $plugin_id, array $plugin_definition, ExpressionManagerInterface $expression_manager, UuidInterface $uuid_service)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->expressionManager = $expression_manager;
     $this->uuidService = $uuid_service;
     $configuration += ['conditions' => []];
     foreach ($configuration['conditions'] as $uuid => $condition_config) {
         $condition = $this->expressionManager->createInstance($condition_config['id'], $condition_config);
         $this->conditions[$uuid] = $condition;
     }
 }
Ejemplo n.º 5
0
 /**
  * Constructs a new class instance.
  *
  * @param array $configuration
  *   A configuration array containing information about the plugin instance.
  *   Contains the following entries:
  *   - action_id: The action plugin ID.
  * @param string $plugin_id
  *   The plugin ID for the plugin instance.
  * @param mixed $plugin_definition
  *   The plugin implementation definition.
  * @param \Drupal\rules\Core\RulesActionManagerInterface $action_manager
  *   The Rules action manager.
  * @param \Drupal\rules\Context\DataProcessorManager $processor_manager
  *   The data processor plugin manager.
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, RulesActionManagerInterface $action_manager, DataProcessorManager $processor_manager)
 {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     $this->actionManager = $action_manager;
     $this->processorManager = $processor_manager;
 }