Issue #2853509 by alexpott: Don't render status messages if there are no messages
parent
f0f5a2ef6d
commit
78ca56777f
|
@ -73,17 +73,22 @@ class StatusMessages extends RenderElement {
|
||||||
* @see drupal_get_messages()
|
* @see drupal_get_messages()
|
||||||
*/
|
*/
|
||||||
public static function renderMessages($type) {
|
public static function renderMessages($type) {
|
||||||
// Render the messages.
|
$render = [];
|
||||||
return [
|
$messages = drupal_get_messages($type);
|
||||||
'#theme' => 'status_messages',
|
if ($messages) {
|
||||||
// @todo Improve when https://www.drupal.org/node/2278383 lands.
|
// Render the messages.
|
||||||
'#message_list' => drupal_get_messages($type),
|
$render = [
|
||||||
'#status_headings' => [
|
'#theme' => 'status_messages',
|
||||||
'status' => t('Status message'),
|
// @todo Improve when https://www.drupal.org/node/2278383 lands.
|
||||||
'error' => t('Error message'),
|
'#message_list' => $messages,
|
||||||
'warning' => t('Warning message'),
|
'#status_headings' => [
|
||||||
],
|
'status' => t('Status message'),
|
||||||
];
|
'error' => t('Error message'),
|
||||||
|
'warning' => t('Warning message'),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $render;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue