In Drupal 8.5 a new Messenger service was introduced to encapsulate the symfony flash bag and you can delete messages with deleteAll : Drupal::messenger-deleteAll; share. Drupalsetmessage bootstrap.inc Drupal 8.2.x, Sets a message to display to the user. Messages are stored in a session variable and displayed in the page template. Could you please give some more details on your Drupal setup? The messenger service is only available for core 8.5.x – baikho Apr 7 '19 at 14:58. Add a comment Active Oldest Votes. Know someone who can answer? Share a link to this question via email, Twitter, or Facebook. Drupal 8 is the latest, greatest release of the world's most widely used enterprise web CMS. Drupal 8 taps into the concentrated innovation from its open source community.You can drive value and streamline your work with new capabilities for successful digital experiences.
As you may know, drupal_set_message() is deprecated in Drupal 8.5.0.
Here’s a quick example of using dependency injection to use the new Messenger service:
Drupal 8 Messenger Services
Drupal 8 Messenger Service
Drupal 8 Url
* Provides authentication functionality for my module.
* @package Drupalmymodule