function EntityReferenceFieldItemNormalizerTrait::fieldItemReferencesTaxonomyTerm

Same name in other branches
  1. 8.9.x core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizerTrait.php \Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizerTrait::fieldItemReferencesTaxonomyTerm()
  2. 10 core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizerTrait.php \Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizerTrait::fieldItemReferencesTaxonomyTerm()
  3. 11.x core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizerTrait.php \Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizerTrait::fieldItemReferencesTaxonomyTerm()

Determines if a field item references a taxonomy term.

Parameters

\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem $field_item: The entity reference item.

Return value

bool

1 call to EntityReferenceFieldItemNormalizerTrait::fieldItemReferencesTaxonomyTerm()
EntityReferenceFieldItemNormalizerTrait::normalizeRootReferenceValue in core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizerTrait.php

File

core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizerTrait.php, line 27

Class

EntityReferenceFieldItemNormalizerTrait
Converts empty reference values for entity reference items.

Namespace

Drupal\serialization\Normalizer

Code

protected function fieldItemReferencesTaxonomyTerm(EntityReferenceItem $field_item) {
    return $field_item->getFieldDefinition()
        ->getSetting('target_type') === 'taxonomy_term';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.