You are here

public function Action::execute in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Entity/Action.php \Drupal\business_rules\Entity\Action::execute()

Execute the action.

Parameters

\Drupal\business_rules\Events\BusinessRulesEvent $event: The event that has triggered the action.

Return value

array The render array to be showed on debug block.

Throws

\ReflectionException

Overrides ActionInterface::execute

File

src/Entity/Action.php, line 111

Class

Action
Defines the Action entity.

Namespace

Drupal\business_rules\Entity

Code

public function execute(BusinessRulesEvent $event) {
  $action_type = $this->itemManager
    ->getDefinition($this
    ->getType());
  $reflection = new \ReflectionClass($action_type['class']);

  /** @var \Drupal\business_rules\Plugin\BusinessRulesActionPlugin $defined_action */
  $defined_action = $reflection
    ->newInstance($action_type, $action_type['id'], $action_type);
  $action = Action::load($this
    ->id());
  $defined_action
    ->processTokens($action, $event);
  return $defined_action
    ->execute($action, $event);
}