function EntityReferenceItemNormalizer::normalizedFieldValues

Same name in other branches
  1. 9 core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php \Drupal\hal\Normalizer\EntityReferenceItemNormalizer::normalizedFieldValues()

Overrides FieldItemNormalizer::normalizedFieldValues

File

core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php, line 161

Class

EntityReferenceItemNormalizer
Converts the Drupal entity reference item object to HAL array structure.

Namespace

Drupal\hal\Normalizer

Code

protected function normalizedFieldValues(FieldItemInterface $field_item, $format, array $context) {
    // Normalize root reference values here so we don't need to deal with hal's
    // nested data structure for field items. This will be called from
    // \Drupal\hal\Normalizer\FieldItemNormalizer::normalize. Which will only
    // be called from this class for entities that are not fieldable.
    $normalized = parent::normalizedFieldValues($field_item, $format, $context);
    $this->normalizeRootReferenceValue($normalized, $field_item);
    return $normalized;
}

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