Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Messenger/MessengerTrait.php \Drupal\Core\Messenger\MessengerTrait::messenger()
  2. 9 core/lib/Drupal/Core/Messenger/MessengerTrait.php \Drupal\Core\Messenger\MessengerTrait::messenger()

Gets the messenger.

Return value

\Drupal\Core\Messenger\MessengerInterface The messenger.

42 calls to MessengerTrait::messenger()
AdvancedSettingsForm::cacheSubmit in core/modules/views_ui/src/Form/AdvancedSettingsForm.php
Submission handler to clear the Views cache.
BlockController::performOperation in core/modules/block/src/Controller/BlockController.php
Calls a method on a block and reloads the listing page.
BookController::bookExport in core/modules/book/src/Controller/BookController.php
Generates representations of a book page and its children.
CommentController::commentApprove in core/modules/comment/src/Controller/CommentController.php
Publishes the specified comment.
ConfigTranslationController::itemPage in core/modules/config_translation/src/Controller/ConfigTranslationController.php
Language translations overview page for a configuration name.

... See full list

File

core/lib/Drupal/Core/Messenger/MessengerTrait.php, line 33

Class

MessengerTrait
Provides a trait for the messenger service.

Namespace

Drupal\Core\Messenger

Code

public function messenger() {
  if (!isset($this->messenger)) {
    $this->messenger = \Drupal::messenger();
  }
  return $this->messenger;
}