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