Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MessageAction.php

function MessageAction::execute

Overrides ExecutableInterface::execute

File

core/lib/Drupal/Core/Action/Plugin/Action/MessageAction.php, line 82

Class

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

Namespace

Drupal\Core\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
    $this->messenger
        ->addStatus($this->renderer
        ->renderInIsolation($build));
}
RSS feed
Powered by Drupal