diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5a4f3d1..2574550 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1075,9 +1075,6 @@ function template_preprocess_datetime(&$variables) { * displaying messages of that specific type. */ function template_preprocess_status_messages(&$variables) { - if (isset($variables['message_list'])) { - return; - } $variables['message_list'] = drupal_get_messages($variables['display']); $variables['status_headings'] = array( 'status' => t('Status message'), @@ -2512,6 +2509,12 @@ function drupal_common_theme() { 'template' => 'datetime', ), 'status_messages' => array( + 'variables' => array('display' => NULL), + 'template' => 'status-messages', + ), + // @TODO changes this to status_messages once the messages are gone from + // template_preprocess_page + 'status_messages_block' => array( 'variables' => array('status_headings' => array(), 'message_list' => NULL, 'display' => NULL), 'template' => 'status-messages', ), diff --git a/core/modules/system/src/Plugin/Block/SystemPageMessagesBlock.php b/core/modules/system/src/Plugin/Block/SystemPageMessagesBlock.php index 154bf07..1d2b8c6 100644 --- a/core/modules/system/src/Plugin/Block/SystemPageMessagesBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemPageMessagesBlock.php @@ -72,11 +72,13 @@ public function defaultConfiguration() { */ public function build() { - $build['message_list'] = array( - '#theme' => 'status_messages', + $build['messages'] = array( + // @TODO change this to status_messages once the messages are gone from + // template_preprocess_page + '#theme' => 'status_messages_block', '#pre_render' => array(array($this, 'getMessages')), ); - $build['message_list']['#status_headings'] = array( + $build['messages']['#status_headings'] = array( 'status' => t('Status message'), 'error' => t('Error message'), 'warning' => t('Warning message'), @@ -92,7 +94,7 @@ public function build() { * @return mixed */ public function getMessages($element) { - $element['#markup'] = drupal_get_messages(); + $element['#message_list'] = drupal_get_messages(); return $element; } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index f703fd1..f20a637 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1108,6 +1108,10 @@ function system_preprocess_block(&$variables) { } break; + case 'system_page_messages_block': + $variables['messages'] = $variables['content']['messages']; + break; + case 'system_powered_by_block': $variables['attributes']['role'] = 'complementary'; break; diff --git a/core/modules/system/templates/block--system-page-messages-block.html.twig b/core/modules/system/templates/block--system-page-messages-block.html.twig index a93c908..86b4b52 100644 --- a/core/modules/system/templates/block--system-page-messages-block.html.twig +++ b/core/modules/system/templates/block--system-page-messages-block.html.twig @@ -14,10 +14,7 @@ * user agents will better describe this landmark. * * Available variables: - * - message_list: List of messages to be displayed, grouped by type. - * - status_headings: List of all status types. - * - display: (optional) May have a value of 'status' or 'error' when only - * displaying messages of that specific type. + * - messages: Status and error messages. Should be displayed prominently. * * @see template_preprocess_status_messages() * @@ -25,26 +22,5 @@ */ #} {% block content %} - {% for type, messages in message_list %} - - {% endfor %} + {{ messages }} {% endblock %} diff --git a/core/themes/bartik/templates/block--system-page-messages.html.twig b/core/themes/bartik/templates/block--system-page-messages.html.twig index 8e2e08b..80e59b6 100644 --- a/core/themes/bartik/templates/block--system-page-messages.html.twig +++ b/core/themes/bartik/templates/block--system-page-messages.html.twig @@ -14,10 +14,7 @@ * user agents will better describe this landmark. * * Available variables: - * - message_list: List of messages to be displayed, grouped by type. - * - status_headings: List of all status types. - * - display: (optional) May have a value of 'status' or 'error' when only - * displaying messages of that specific type. + * - messages: Status and error messages. Should be displayed prominently. * * @see template_preprocess_status_messages() * @@ -25,28 +22,9 @@ */ #} {% block content %} -
- {% for type, messages in message_list %} - - {% endfor %} -
+ {% if messages %} +
+ {{ messages }} +
+ {% endif %} {% endblock %}