How to clear messages queue generated from drupal set message when popups api ajax are open in Drupal?
Drupal 5-8: running drupal_get_messages() will clear the messages.
In 8.5.x there is a new Messenger service you can use. The drupal_get_messages()
function will be deprecated.
Clearing all messages using the Messenger service:
$messages = \Drupal::messenger()->deleteAll();
Drupal 7:
The messages are in $_SESSION if you want to clear for example the "status"-Messages you can do it like that:
if (isset($_SESSION['messages']['status'])) {
unset($_SESSION['messages']['status']);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With