You are here

public function EntityReferenceItemNormalizer::normalize in Tome 8

Overrides EntityReferenceFieldItemNormalizer::normalize

1 call to EntityReferenceItemNormalizer::normalize()
EntityReferenceRevisionItemNormalizer::normalize in modules/tome_sync/src/Normalizer/EntityReferenceRevisionItemNormalizer.php
Normalizes an object into a set of arrays/scalars.
1 method overrides EntityReferenceItemNormalizer::normalize()
EntityReferenceRevisionItemNormalizer::normalize in modules/tome_sync/src/Normalizer/EntityReferenceRevisionItemNormalizer.php
Normalizes an object into a set of arrays/scalars.

File

modules/tome_sync/src/Normalizer/EntityReferenceItemNormalizer.php, line 17

Class

EntityReferenceItemNormalizer
Normalizer for entity reference fields.

Namespace

Drupal\tome_sync\Normalizer

Code

public function normalize($field_item, $format = NULL, array $context = []) {
  $values = parent::normalize($field_item, $format, $context);
  if (isset($values['target_id']) && is_numeric($values['target_id'])) {
    unset($values['target_id']);
  }
  if (isset($values['url'])) {
    unset($values['url']);
  }
  return $values;
}