function LegacyMessenger::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/ LegacyMessenger.php, line 180
Class
- LegacyMessenger
- Provides a LegacyMessenger implementation.
Namespace
Drupal\Core\MessengerCode
public function deleteByType($type) {
// Proxy to the Messenger service, if it exists.
if ($messenger = $this->getMessengerService()) {
return $messenger->deleteByType($type);
}
$messages = static::$messages[$type];
unset(static::$messages[$type]);
return $messages;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.