You are here

public function MessengerTrait::messenger in Drupal 8

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

Gets the messenger.

Return value

\Drupal\Core\Messenger\MessengerInterface The messenger.

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;
}