public function FieldItemNormalizer::normalize in Tome 8
Overrides ComplexDataNormalizer::normalize
File
- modules/
tome_sync/ src/ Normalizer/ FieldItemNormalizer.php, line 18
Class
- FieldItemNormalizer
- Normalizer for fields.
Namespace
Drupal\tome_sync\NormalizerCode
public function normalize($object, $format = NULL, array $context = []) {
$values = parent::normalize($object, $format, $context);
if ($object instanceof ComplexDataInterface) {
foreach ($object
->getDataDefinition()
->getPropertyDefinitions() as $name => $property) {
// Remove computed properties from the normalized file to reduce noise.
if ($property
->isComputed() && isset($values[$name])) {
unset($values[$name]);
}
}
}
return $values;
}