diff --git a/core/includes/theme.inc b/core/includes/theme.inc index f98df80..564a8a4 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2396,6 +2396,10 @@ function template_preprocess_region(&$variables) { function template_preprocess_field(&$variables, $hook) { $element = $variables['element']; + if($element['#items']->getFieldDefinition()->getCardinality() != "1"){ + $variables['multiple'] = TRUE; + } + // There's some overhead in calling check_plain() so only call it if the label // variable is being displayed. Otherwise, set it to NULL to avoid PHP // warnings if a theme implementation accesses the variable even when it's 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..3d9f16a 100644 --- a/core/modules/system/templates/field.html.twig +++ b/core/modules/system/templates/field.html.twig @@ -29,13 +29,41 @@ * @ingroup themeable */ #} -