function Messenger::deleteByType

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Messenger/Messenger.php \Drupal\Core\Messenger\Messenger::deleteByType()
  2. 8.9.x core/lib/Drupal/Core/Messenger/Messenger.php \Drupal\Core\Messenger\Messenger::deleteByType()
  3. 10 core/lib/Drupal/Core/Messenger/Messenger.php \Drupal\Core\Messenger\Messenger::deleteByType()

Deletes all messages of a certain type.

Parameters

string $type: The messages' type. Either self::TYPE_STATUS, self::TYPE_WARNING, or self::TYPE_ERROR.

Return value

string[]|\Drupal\Component\Render\MarkupInterface[] The deleted messages of given type.

Overrides MessengerInterface::deleteByType

File

core/lib/Drupal/Core/Messenger/Messenger.php, line 100

Class

Messenger
The messenger service.

Namespace

Drupal\Core\Messenger

Code

public function deleteByType($type) {
  // Flash bag gets and clears flash messages from the stack.
  return $this->flashBag
    ->get($type);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.