diff -u b/core/includes/theme.inc b/core/includes/theme.inc --- b/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1067,73 +1067,6 @@ } /** - * Prepares variables for inline list templates. - * - * Default template: inline-list.html.twig. - * - * @param array $variables - * An associative array containing: - * - items: An array of items to be displayed in the list. Each item can be - * either a string or a render array. If #type, #theme, or #markup - * properties are not specified for child render arrays, they will be - * inherited from the parent list, allowing callers to specify larger - * nested lists without having to explicitly specify and repeat the - * render properties for all nested child lists. - * - separator: A string to separate list items. - * - * @see https://www.drupal.org/node/1842756 - */ -function template_preprocess_inline_list(&$variables) { - foreach ($variables['items'] as &$item) { - $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 '#wrapper_attributes' property. - if (isset($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 - // elements present nested lists and we automatically inherit the render - // array properties of the current list to them. - foreach (Element::children($item) as $key) { - $child = &$item[$key]; - // If this child element does not specify how it can be rendered, then - // we need to inherit the render properties of the current list. - if (!isset($child['#type']) && !isset($child['#theme']) && !isset($child['#markup'])) { - // Since inline-list.html.twig supports both strings and render arrays - // as items, the items of the nested list may have been specified as - // the child elements of the nested list, instead of #items. For - // convenience, we automatically move them into #items. - if (!isset($child['#items'])) { - // This is the same condition as in - // \Drupal\Core\Render\Element::children(), which cannot be used - // here, since it triggers an error on string values. - foreach ($child as $child_key => $child_value) { - if ($child_key[0] !== '#') { - $child['#items'][$child_key] = $child_value; - unset($child[$child_key]); - } - } - } - // Lastly, inherit the original theme variables of the current list. - $child['#theme'] = $variables['theme_hook_original']; - } - } - } - - // Set the item's value and attributes for the template. - $item = array( - 'value' => $item, - 'attributes' => new Attribute($attributes), - ); - - // Since the separator may be user-specified, it must be sanitized. - $variables['separator'] = SafeString::create(Xss::filterAdmin($variables['separator'])); - } -} - -/** * Returns HTML for an indentation div; used for drag and drop tables. * * @param $variables diff -u b/core/modules/system/templates/inline-list.html.twig b/core/modules/system/templates/inline-list.html.twig --- b/core/modules/system/templates/inline-list.html.twig +++ b/core/modules/system/templates/inline-list.html.twig @@ -4,11 +4,8 @@ * Default theme implementation for an inline list of items. * * Available variables: - * - items: A list of items. Each item contains: - * - attributes: HTML attributes to be applied to each list item. - * - value: The content of the list element. + * - items: An array of items. * - separator: A string to separate list items. - * - 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. * @@ -18,7 +15,7 @@ */ #} {%- for item in items -%} - {{ item.value }}{{ loop.last ? '' : separator }} + {{ item }}{{ loop.last ? '' : separator }} {%- else -%} {{- empty -}} {%- endfor -%} reverted: --- b/core/themes/classy/templates/dataset/inline-list.html.twig +++ /dev/null @@ -1,30 +0,0 @@ -{# -/** - * @file - * Theme override for an inline list of items. - * - * Available variables: - * - items: A list of items. Each item contains: - * - attributes: HTML attributes to be applied to each list item. - * - value: The content of the list element. - * - separator: A string to separate list items. - * - 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. - * - * @see template_preprocess_inline_list() - * - * @ingroup themeable - */ -#} -{%- if items or empty -%} - {%- if items -%} - - {%- for item in items -%} - {{ item.value }} - {%- endfor -%} - - {%- else -%} - {{- empty -}} - {%- endif -%} -{%- endif %}