diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceFormatterBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceFormatterBase.php index 994aea2..8b848ac 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceFormatterBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceFormatterBase.php @@ -24,7 +24,9 @@ public function view(EntityInterface $entity, $langcode, array $items) { $addition = parent::view($entity, $langcode, $items); // Add a target type variable. - $addition[$this->field['field_name']]['#entity_reference_target_type'] = $this->field['settings']['target_type']; + if (!empty($addition)) { + $addition[$this->field['field_name']]['#entity_reference_target_type'] = $this->field['settings']['target_type']; + } return $addition; } diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index a2d55c4..be3fcee 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -783,9 +783,7 @@ function rdf_field_attach_view_alter(&$output, $context) { // Append term mappings on displayed taxonomy links. foreach (element_children($output) as $field_name) { $element = &$output[$field_name]; - $field_name = $element['#field_name']; - $field = field_info_field($field_name); - if ($field['type'] != 'entity_reference' || $field['settings']['target_type'] != 'taxonomy_term') { + if (isset($variables['element']['#entity_reference_target_type']) && $variables['element']['#entity_reference_target_type'] != 'taxonomy_term') { // Not an entity reference field referencing taxonomy terms. continue; } diff --git a/core/themes/bartik/template.php b/core/themes/bartik/template.php index 82775a3..3ef50b9 100644 --- a/core/themes/bartik/template.php +++ b/core/themes/bartik/template.php @@ -152,7 +152,7 @@ function bartik_field__entity_reference($variables) { $output .= ''; // Add a target type specific class. - $variables['attributes']['class'][] = $variables['field_type_css'] . '-' . strtr($variables['element']['#entity_reference_target_type'], '_', '-'); + $variables['attributes']['class'][] = 'field-type-' . $variables['field_type_css'] . '-' . strtr($variables['element']['#entity_reference_target_type'], '_', '-'); // Render the top-level DIV. $variables['attributes']['class'][] = 'clearfix';