diff --git a/src/Exporter/ContentExporter.php b/src/Exporter/ContentExporter.php index 6bc0269..0fd92f3 100755 --- a/src/Exporter/ContentExporter.php +++ b/src/Exporter/ContentExporter.php @@ -27,7 +27,7 @@ public function __construct(Serializer $serializer) { */ public function exportEntity(ContentEntityInterface $entity, array $context = []) { $context = $this->context + $context; - // Allows to know to normalizers that this is a content sync generated entity. + // Allows normalizers to know that this is a content sync generated entity. $context += [ 'content_sync' => TRUE, ]; diff --git a/src/Normalizer/ContentEntityNormalizer.php b/src/Normalizer/ContentEntityNormalizer.php index e8f8312..8d7fce1 100755 --- a/src/Normalizer/ContentEntityNormalizer.php +++ b/src/Normalizer/ContentEntityNormalizer.php @@ -303,4 +303,19 @@ protected function cleanupData(&$data, $entity_type_id, $bundle = FALSE) { } } + + /** + * @inheritdoc + */ + public function supportsNormalization($data, $format = NULL, array $context = []): bool { + return parent::supportsNormalization($data, $format, $context) && ($context['content_sync'] ?? FALSE); + } + + /** + * @inheritdoc + */ + public function supportsDenormalization($data, $type, $format = NULL, array $context = []): bool { + return parent::supportsDenormalization($data, $type, $format, $context); + } + }