public function MessageAction::execute in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php \Drupal\Core\Action\Plugin\Action\MessageAction::execute()
Executes the plugin.
Overrides ExecutableInterface::execute
File
- core/
lib/ Drupal/ Core/ Action/ Plugin/ Action/ MessageAction.php, line 81
Class
- MessageAction
- Sends a message to the current user's screen.
Namespace
Drupal\Core\Action\Plugin\ActionCode
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
$this->messenger
->addStatus($this->renderer
->renderPlain($build));
}