Same name and namespace in other branches
  1. 8.9.x 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.

143 calls to MessengerTrait::messenger()
ActionFormBase::save in core/modules/action/src/Form/ActionFormBase.php
Form submission handler for the 'save' action.
AddFormBase::removeButtonSubmit in core/modules/media_library/src/Form/AddFormBase.php
Submit handler for the remove button.
AjaxFormsTestValidationForm::submitForm in core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php
Form submission handler.
BanAdmin::submitForm in core/modules/ban/src/Form/BanAdmin.php
Form submission handler.
BanDelete::submitForm in core/modules/ban/src/Form/BanDelete.php
Form submission handler.

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