Skip to content
Snippets Groups Projects
Commit e1b6d232 authored by catch's avatar catch
Browse files

Issue #3002522 by andypost, Matthijs, tim.plunkett, wizonesolutions: Calling...

Issue #3002522 by andypost, Matthijs, tim.plunkett, wizonesolutions: Calling StatusMessages::renderMessages() with a  returns a faulty render array
parent 125e9f41
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -76,7 +76,9 @@ public static function generatePlaceholder(array $element) {
public static function renderMessages($type = NULL) {
$render = [];
if (isset($type)) {
$messages = \Drupal::messenger()->deleteByType($type);
$messages = [
$type => \Drupal::messenger()->deleteByType($type),
];
}
else {
$messages = \Drupal::messenger()->deleteAll();
......
......@@ -32,6 +32,14 @@ public function testMessages() {
$this->render($messages);
$this->assertRaw('messages messages--error');
$this->assertRaw('messages messages--status');
// Tests display of only one type of messages.
\Drupal::messenger()->addError('An error occurred');
$messages = [
'#type' => 'status_messages',
'#display' => 'error',
];
$this->render($messages);
$this->assertRaw('messages messages--error');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment