You are here

public function MessengerTrait::messenger in Drupal 10

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

161 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.
AdvancedSettingsForm::cacheSubmit in core/modules/views_ui/src/Form/AdvancedSettingsForm.php
Submission handler to clear the Views cache.
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.

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