You are here

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

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

Execute the action.

Parameters

\Drupal\business_rules\ActionInterface $action: The configured action.

\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.

Overrides BusinessRulesActionPlugin::execute

File

src/Plugin/BusinessRulesAction/FetchEntityVariableAction.php, line 109

Class

FetchEntityVariableAction
Class FetchEntityVariable.

Namespace

Drupal\business_rules\Plugin\BusinessRulesAction

Code

public function execute(ActionInterface $action, BusinessRulesEvent $event) {

  /** @var \Drupal\business_rules\VariablesSet $variables */
  $id_variable = $action
    ->getSettings('empty_variable');
  $variables = $event
    ->getArgument('variables');
  $processed_variables = $this
    ->fetchEntityVariable($action, $variables);
  $event
    ->setArgument('variables', $processed_variables);
  $result = [
    '#type' => 'markup',
    '#markup' => t('Entity variable %variable fetched.', [
      '%variable' => $id_variable,
    ]),
  ];
  return $result;
}