diff --git a/core/includes/theme.inc b/core/includes/theme.inc index f98df80..3896d71 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2418,6 +2418,12 @@ function template_preprocess_field(&$variables, $hook) { $delta++; } + // We have to know if the field has multiple values to create a simple value + // or a list. + if (count($variables['items']) > 1 ) { + $variables['multiple'] = TRUE; + } + // Add default CSS classes. Since there can be many fields rendered on a page, // save some overhead by calling strtr() directly instead of // drupal_html_class(). diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUITest.php index dd6d13e..7ab6116 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/div/div/following-sibling::text()[contains(.,: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..3e708e2 100644 --- a/core/modules/system/templates/field.html.twig +++ b/core/modules/system/templates/field.html.twig @@ -33,9 +33,14 @@ {% if not label_hidden %}
{{ label }}: 
{% endif %} -
+ + {% if multiple %} +
+ + {% else %} + {{ items }} + {% endif %}