Skip to content

Instantly share code, notes, and snippets.

@henideepak
Last active July 29, 2021 12:42
Show Gist options
  • Save henideepak/55b791914edb8c6d824d0b8d8ba8c4a6 to your computer and use it in GitHub Desktop.
Save henideepak/55b791914edb8c6d824d0b8d8ba8c4a6 to your computer and use it in GitHub Desktop.
Drupal Message Service
\Drupal::messenger()->addStatus('Cache rebuild complete.');
\Drupal::messenger()->addWarning(t('The reference view %view_name cannot be found.', ['%view_name' => $view_name]));
\Drupal::messenger()->addError(t('The user account %id does not exist.', ['%id' => $uid]));
\Drupal::messenger()->addMessage($message, 'status');
\Drupal::messenger()->addMessage($message, 'warning');
\Drupal::messenger()->addMessage($message, 'error');
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Messenger%21MessengerInterface.php/function/MessengerInterface%3A%3AaddMessage/9.2.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment