diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 178702b..14b0d44 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2457,7 +2457,8 @@ function template_preprocess_field(&$variables, $hook) { // formatters leave them within $element['#items'][$delta]['_attributes'] to // be rendered on the item wrappers provided by field.html.twig. foreach ($variables['items'] as $delta => $item) { - $variables['item_attributes'][$delta] = !empty($element['#items'][$delta]->_attributes) ? new Attribute($element['#items'][$delta]->_attributes) : clone($default_attributes); + $variables['items'][$delta]['value'] = $item; + $variables['items'][$delta]['attributes'] = !empty($element['#items'][$delta]->_attributes) ? new Attribute($element['#items'][$delta]->_attributes) : clone($default_attributes); } } diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php index dd6d13e..0bd1721 100644 --- a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php +++ b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php @@ -340,7 +340,7 @@ function testNodeDisplay() { $output = '1'; } - $elements = $this->xpath('//div[text()="' . $output . '"]'); + $elements = $this->xpath('//div[text()=:output]', array(':output' => $output)); $this->assertEqual(count($elements), 1, 'Correct options found.'); } } diff --git a/core/modules/system/templates/field.html.twig b/core/modules/system/templates/field.html.twig index a0d527a..12ba596 100644 --- a/core/modules/system/templates/field.html.twig +++ b/core/modules/system/templates/field.html.twig @@ -29,13 +29,26 @@ * @ingroup themeable */ #} - - {% if not label_hidden %} -
{{ label }}: 
- {% endif %} -
- {% for delta, item in items %} -
{{ item }}
- {% endfor %} +{% if items.length > 1 %} +
+ {% if not label_hidden %} +
{{ label }}
+ {% endif %} +
    + {% for item in items %} +
  • {{ item.value }}
  • + {% endfor %} +
-
+{% else %} + {% for item in items %} + {% if not label_hidden %} +
+
{{ label }}
+
{{ item.value }}
+
+ {% else %} +
{{ item.attibutes }}
+ {% endif %} + {% endfor %} +{% endif %}