You are here

public function MessageAction::execute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/action/src/Plugin/Action/MessageAction.php \Drupal\action\Plugin\Action\MessageAction::execute()

Executes the plugin.

Overrides ExecutableInterface::execute

File

core/modules/action/src/Plugin/Action/MessageAction.php, line 75
Contains \Drupal\action\Plugin\Action\MessageAction.

Class

MessageAction
Sends a message to the current user's screen.

Namespace

Drupal\action\Plugin\Action

Code

public function execute($entity = NULL) {
  if (empty($this->configuration['node'])) {
    $this->configuration['node'] = $entity;
  }
  $message = $this->token
    ->replace($this->configuration['message'], $this->configuration);
  $build = [
    '#markup' => $message,
  ];

  // @todo Fix in https://www.drupal.org/node/2577827
  drupal_set_message($this->renderer
    ->renderPlain($build));
}