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

Breadcrumb

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

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal