diff --git a/core/includes/theme.inc b/core/includes/theme.inc index b3deb32..a7b5eef 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -999,6 +999,7 @@ function template_preprocess_tablesort_indicator(&$variables) { * @see https://www.drupal.org/node/1842756 */ function template_preprocess_item_list(&$variables) { + $variables['wrapper_attributes'] = new Attribute($variables['wrapper_attributes']); foreach ($variables['items'] as &$item) { $attributes = array(); // If the item value is an array, then it is a render array. @@ -1718,7 +1719,7 @@ function drupal_common_theme() { 'variables' => array('status' => MARK_NEW), ), 'item_list' => array( - 'variables' => array('items' => array(), 'title' => '', 'list_type' => 'ul', 'attributes' => array(), 'empty' => NULL, 'context' => array()), + 'variables' => array('items' => array(), 'title' => '', 'list_type' => 'ul', 'wrapper_attributes' => array(), 'attributes' => array(), 'empty' => NULL, 'context' => array()), ), 'feed_icon' => array( 'variables' => array('url' => NULL, 'title' => NULL), diff --git a/core/modules/system/templates/item-list.html.twig b/core/modules/system/templates/item-list.html.twig index 172799d..1462cf4 100644 --- a/core/modules/system/templates/item-list.html.twig +++ b/core/modules/system/templates/item-list.html.twig @@ -9,6 +9,7 @@ * - value: The content of the list element. * - title: The title of the list. * - list_type: The tag for list element ("ul" or "ol"). + * - wrapper_attributes: HTML attributes to be applied to the list wrapper. * - attributes: HTML attributes to be applied to the list. * - empty: A message to display when there are no items. Allowed value is a * string or render array. @@ -21,9 +22,9 @@ */ #} {% if context.list_style %} - {% set attributes = attributes.addClass('item-list__' ~ context.list_style) %} + {%- set attributes = attributes.addClass('item-list__' ~ context.list_style) %} {% endif %} -{%- if items or empty -%} +{% if items or empty %} {%- if title is not empty -%}