diff -u b/core/includes/theme.inc b/core/includes/theme.inc --- b/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1075,10 +1075,7 @@ * 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'], FALSE); + $variables['message_list'] = drupal_get_messages($variables['display']); $variables['status_headings'] = array( 'status' => t('Status message'), 'error' => t('Error message'), @@ -2512,7 +2509,13 @@ 'template' => 'datetime', ), 'status_messages' => array( - 'variables' => array('status_headings' => array(), 'message_list' => NULL, 'display' => NULL), + 'variables' => array('display' => NULL), + 'template' => 'status-messages', + ), + // @TODO change 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), 'template' => 'status-messages', ), 'links' => array( diff -u b/core/modules/system/src/Plugin/Block/SystemPageMessagesBlock.php b/core/modules/system/src/Plugin/Block/SystemPageMessagesBlock.php --- b/core/modules/system/src/Plugin/Block/SystemPageMessagesBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemPageMessagesBlock.php @@ -73,7 +73,9 @@ public function build() { $build['message_list'] = array( - '#theme' => 'status_messages', + // @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( @@ -92,7 +94,7 @@ * @return mixed */ public function getMessages($element) { - $element['#markup'] = drupal_get_messages(); + $element['#message_list'] = drupal_get_messages(); return $element; } diff -u b/core/modules/system/templates/block--system-page-messages-block.html.twig b/core/modules/system/templates/block--system-page-messages-block.html.twig --- b/core/modules/system/templates/block--system-page-messages-block.html.twig +++ b/core/modules/system/templates/block--system-page-messages-block.html.twig @@ -1,50 +1,57 @@ -{% extends "@block/block.html.twig" %} {# /** * @file - * Default theme implementation for status messages. - * - * Displays status, error, and warning messages, grouped by type. - * - * An invisible heading identifies the messages for assistive technology. - * Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html - * for info. - * - * Add an ARIA label to the contentinfo area so that assistive technology - * user agents will better describe this landmark. + * Default theme implementation to display a block. * * 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. + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - module: The module that provided this block plugin. + * - cache: The cache settings. + * - Block plugin specific settings will also be stored here. + * - block - The full block entity. + * - label_hidden: The hidden block title value if the block was + * configured to hide the title ('label' is empty in this case). + * - module: The module that generated the block. + * - delta: An ID for the block, unique within each module. + * - region: The block region embedding the current block. + * - content: The content of this block. + * - attributes: HTML attributes for the containing element. + * - id: A valid HTML ID and guaranteed unique. + * - class: Classes that can be used to style contextually through + * CSS. These can be manipulated through preprocess functions. The default + * values can be one or more of the following: + * - block: The current template type, i.e., "theming hook". + * - block-[module]: The module generating the block. For example, the user + * module is responsible for handling the default user navigation block. + * In that case the class would be 'block-user'. + * - title_attributes: HTML attributes for the title element. + * - content_attributes: HTML attributes for the content element. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. * - * @see template_preprocess_status_messages() + * @see template_preprocess_block() * * @ingroup themeable */ + @todo Remove the div around content as per http://drupal.org/node/1972122. #} -{% block content %} - {% for type, messages in message_list %} - - {% endfor %} -{% endblock %} + + {{ plugin_id }} + {{ title_prefix }} + {% if label %} + {{ label }} + {% endif %} + {{ title_suffix }} + + + {% block content %} + {{ content }} + {% endblock %} + +