function MessageAction::execute
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php \Drupal\Core\Action\Plugin\Action\MessageAction::execute()
- 10 core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php \Drupal\Core\Action\Plugin\Action\MessageAction::execute()
- 11.x core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php \Drupal\Core\Action\Plugin\Action\MessageAction::execute()
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));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.