/** * Converts and adds ImageAdjustments to the ImageVariant * * @param ImageInterface $asset * @param mixed $source * @param array $convertedChildProperties * @param PropertyMappingConfigurationInterface $configuration * @return ImageInterface|NULL */ protected function applyTypeSpecificHandling($asset, $source, array $convertedChildProperties, PropertyMappingConfigurationInterface $configuration) { if ($asset instanceof ImageVariant) { $adjustments = []; if (isset($source['adjustments'])) { foreach ($source['adjustments'] as $adjustmentType => $adjustmentOptions) { if (isset($adjustmentOptions['__type'])) { $adjustmentType = $adjustmentOptions['__type']; unset($adjustmentOptions['__type']); } $identity = null; if (isset($adjustmentOptions['__identity'])) { $identity = $adjustmentOptions['__identity']; unset($adjustmentOptions['__identity']); } $adjustment = $this->propertyMapper->convert($adjustmentOptions, $adjustmentType, $configuration); if ($identity !== null) { ObjectAccess::setProperty($adjustment, 'persistence_object_identifier', $identity, true); } $adjustments[] = $adjustment; } } elseif (isset($source['processingInstructions'])) { $adjustments = $this->processingInstructionsConverter->convertFrom($source['processingInstructions'], 'array'); } if (count($adjustments) > 0) { $asset->addAdjustments($adjustments); } } return $asset; }