return $criteriaCollection;
} public function enrich(CmsSlotEntity
$slot, ResolverContext
$resolverContext, ElementDataCollection
$result): void
{ $config =
$slot->
getFieldConfig();
$image =
new ImageStruct();
$slot->
setData($image);
$mediaConfig =
$config->
get('previewMedia'
);
if ($mediaConfig &&
$mediaConfig->
getValue()) { $this->
addMediaEntity($slot,
$image,
$result,
$mediaConfig,
$resolverContext);
} } private function addMediaEntity(CmsSlotEntity
$slot, ImageStruct
$image, ElementDataCollection
$result, FieldConfig
$config, ResolverContext
$resolverContext): void
{ if ($config->
isMapped() &&
$resolverContext instanceof EntityResolverContext
) { $media =
$this->
resolveEntityValue($resolverContext->
getEntity(),
$config->
getStringValue());
if ($media instanceof MediaEntity
) { $image->
setMediaId($media->
getUniqueIdentifier());
$image->
setMedia($media);
}