diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 0a74451..1ee3e9e 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1788,9 +1788,9 @@ function template_preprocess_item_list(&$variables) { $attributes = array(); // If the item value is an array, then it is a render array. if (is_array($item)) { - // List items support attributes via the 'attributes' property. - if (isset($item['attributes']) && is_array($item['attributes'])) { - $attributes = $item['attributes']; + // List items support attributes via the '#wrapper_attributes' property. + if (isset($item['#wrapper_attributes']) && is_array($item['#wrapper_attributes'])) { + $attributes = $item['#wrapper_attributes']; } // Determine whether there are any child elements in the item that are not // fully-specified render arrays. If there are any, then the child @@ -1821,13 +1821,12 @@ function template_preprocess_item_list(&$variables) { } } } - else { - // Turn the item into an array if it wasn't one already. - $item = array('value' => $item); - } + + // Store item value for Twig. + $item = array('value' => $item); // Store item attributes for Twig. - $item['attributes'] = new Attribute($attributes); + $item['attributes'] = new Attribute($attributes); } } diff --git a/core/modules/system/templates/item-list.html.twig b/core/modules/system/templates/item-list.html.twig index 2936224..1586b78 100644 --- a/core/modules/system/templates/item-list.html.twig +++ b/core/modules/system/templates/item-list.html.twig @@ -30,7 +30,7 @@ {%- endif %} {%- for item in items -%} -
  • {{ item.value }}
  • + {{ item.value }} {%- endfor -%} {%- if list_type == 'ul' -%}