' . $variables['label'] . '
';
- }
-
- // Render the items.
- $output .= '';
- foreach ($variables['items'] as $delta => $item) {
- $classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
- $output .= '
' . drupal_render($item) . '
';
- }
- $output .= '
';
-
- // Render the top-level DIV.
- $output = '' . $output . '
';
-
- return $output;
-}
-
-/**
* Assembles a partial entity structure with initial IDs.
*
* @param object $ids
diff --git a/core/modules/field/templates/field-multiple-value-form.html.twig b/core/modules/field/templates/field-multiple-value-form.html.twig
new file mode 100644
index 0000000..e6f0ba0
--- /dev/null
+++ b/core/modules/field/templates/field-multiple-value-form.html.twig
@@ -0,0 +1,38 @@
+{#
+/**
+ * @file
+ * Default theme implementation for an individual form element.
+ *
+ * Available variables for all fields:
+ * - multiple_cardinality: Whether the field is multiple cardinality or not.
+ *
+ * Available variables for single cardinality fields:
+ * - elements: Form elements to be rendered.
+ *
+ * Available variables for multiple cardinality fields:
+ * - table: Table of field items for multiple cardinality fields.
+ * - description: Description text for the form element.
+ * - button: "Add another item" button.
+ *
+ * @see template_preprocess_field()
+ *
+ * @ingroup themeable
+ */
+#}
+{% if multiple_cardinality %}
+
{% if not label_hidden %}
{{ label }}:
diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme
index e334125..97fbf3d 100644
--- a/core/themes/bartik/bartik.theme
+++ b/core/themes/bartik/bartik.theme
@@ -6,6 +6,7 @@
*/
use Drupal\Core\Template\RenderWrapper;
+use Drupal\Core\Template\Attribute;
/**
* Implements hook_preprocess_HOOK() for HTML document templates.
@@ -173,25 +174,20 @@ function bartik_menu_tree__shortcut_default($variables) {
}
/**
- * Implements theme_field__field_type().
+ * Implements theme_preprocess_HOOK() for field templates
+ * @see template_preprocess_field()
+ * @todo Use hook_theme_prepare_theme_hook when issue is resolved https://drupal.org/node/2035055
*/
-function bartik_field__taxonomy_term_reference($variables) {
- $output = '';
+function bartik_preprocess_field(&$variables) {
+ $element = $variables['element'];
+ if ($element['#field_type'] == 'taxonomy_term_reference') {
+ $label_attributes['class'] = array('field-label');
- // Render the label either as a visible list or make it visually hidden for accessibility.
- $hidden_class = empty($variables['label_hidden']) ? '' : ' visually-hidden';
- $output .= '
' . $variables['label'] . ':
';
+ if ($variables['label_hidden']) {
+ $label_attributes['class'][] = 'visually-hidden';
+ }
- // Render the items.
- $output .= ($variables['element']['#label_display'] == 'inline') ? '
' : '';
- foreach ($variables['items'] as $delta => $item) {
- $output .= '- ' . drupal_render($item) . '
';
- }
- $output .= '
';
-
- // Render the top-level DIV.
- $variables['attributes']['class'][] = 'clearfix';
- $output = '' . $output . '
';
-
- return $output;
+ $variables['label_attributes'] = new Attribute($label_attributes);
+ }
}
+
diff --git a/core/themes/bartik/templates/field--taxonomy-term-reference.html.twig b/core/themes/bartik/templates/field--taxonomy-term-reference.html.twig
new file mode 100644
index 0000000..13fe36e
--- /dev/null
+++ b/core/themes/bartik/templates/field--taxonomy-term-reference.html.twig
@@ -0,0 +1,28 @@
+{#
+/**
+ * @file
+ * Bartik theme override for taxonomy term fields.
+ *
+ * Available variables:
+ * - attributes: HTML attributes for the containing element.
+ * - label_hidden: Whether the field label has been set to hidden.
+ * - label_attributes: HTML attributes for the label.
+ * - title_attributes: HTML attributes for the title.
+ * - label: The label for the field.
+ * - content_attributes: HTML attributes for the content.
+ * - items: List of all the field items.
+ * - item_attributes: HTML attributes for each item.
+ *
+ * @see template_preprocess_field()
+ * @see bartik_preprocess_field()
+ * @ingroup themeable
+ */
+#}
+
+
{{ label }}:
+
+ {% for delta, item in items %}
+ - {{ item }}
+ {% endfor %}
+
+