Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

ImageAsset/AliasGenerator.php
Go to the documentation of this file.
1 <?php
2
7 declare(strict_types=1);
8
9 namespace eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset;
10
11 use eZ\Publish\API\Repository\ContentService;
12 use eZ\Publish\API\Repository\Values\Content\Field;
13 use eZ\Publish\API\Repository\Values\Content\VersionInfo;
14 use eZ\Publish\Core\FieldType\ImageAsset\AssetMapper;
15 use eZ\Publish\SPI\FieldType\Value;
16 use eZ\Publish\SPI\Variation\Values\Variation;
17 use eZ\Publish\SPI\Variation\VariationHandler;
18 use eZ\Publish\Core\FieldType\ImageAsset\Value as ImageAssetValue;
19
23 class AliasGenerator implements VariationHandler
24 {
26 private $innerAliasGenerator;
27
29 private $contentService;
30
32 private $assetMapper;
33
39 public function __construct(
40 VariationHandler $innerAliasGenerator,
41 ContentService $contentService,
42 AssetMapper $assetMapper)
43 {
44 $this->innerAliasGenerator = $innerAliasGenerator;
45 $this->contentService = $contentService;
46 $this->assetMapper = $assetMapper;
47 }
48
52 public function getVariation(Field $field, VersionInfo $versionInfo, $variationName, array $parameters = []): Variation
53 {
54 if ($this->supportsValue($field->value)) {
55 $destinationContent = $this->contentService->loadContent(
56 $field->value->destinationContentId
57 );
58
59 return $this->innerAliasGenerator->getVariation(
60 $this->assetMapper->getAssetField($destinationContent),
61 $destinationContent->versionInfo,
62 $variationName,
63 $parameters
64 );
65 }
66
67 return $this->innerAliasGenerator->getVariation($field, $versionInfo, $variationName, $parameters);
68 }
69
77 public function supportsValue(Value $value): bool
78 {
79 return $value instanceof ImageAssetValue;
80 }
81 }
eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset\AliasGenerator
Alias Generator Decorator allowing generate variations based on passed ImageAsset\Value.
Definition: ImageAsset/AliasGenerator.php:24
eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset\AliasGenerator\$contentService
$contentService
Definition: ImageAsset/AliasGenerator.php:29
eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset\AliasGenerator\getVariation
getVariation(Field $field, VersionInfo $versionInfo, $variationName, array $parameters=[])
{Returns a Variation object for $field's $variationName.This method is responsible to create the vari...
Definition: ImageAsset/AliasGenerator.php:52
eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset\AliasGenerator\$assetMapper
$assetMapper
Definition: ImageAsset/AliasGenerator.php:32
eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset\AliasGenerator\__construct
__construct(VariationHandler $innerAliasGenerator, ContentService $contentService, AssetMapper $assetMapper)
Definition: ImageAsset/AliasGenerator.php:39
eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset\AliasGenerator\supportsValue
supportsValue(Value $value)
Returns TRUE if the value is supported by alias generator.
Definition: ImageAsset/AliasGenerator.php:77
eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset\AliasGenerator\$innerAliasGenerator
$innerAliasGenerator
Definition: ImageAsset/AliasGenerator.php:26
eZ\Publish\API\Repository\Values\Content\Field
Definition: API/Repository/Values/Content/Field.php:21
eZ\Publish\API\Repository\Values\Content\Query\Criterion\Value
Struct that stores extra value information for a Criterion object.
Definition: API/Repository/Values/Content/Query/Criterion/Value.php:13
eZ\Publish\API\Repository\Values\Content\VersionInfo
Definition: API/Repository/Values/Content/VersionInfo.php:27
eZ\Publish\Core\FieldType\ImageAsset\AssetMapper
Definition: AssetMapper.php:21
eZ\Publish\SPI\Variation\Values\Variation
Definition: Variation.php:22
eZ\Publish\API\Repository\ContentService
Definition: API/Repository/ContentService.php:27
eZ\Publish\SPI\FieldType\Value
Interface for field value classes.
Definition: SPI/FieldType/Value.php:13
eZ\Publish\SPI\Variation\VariationHandler
Interface for Variation services.
Definition: VariationHandler.php:18
eZ\Bundle\EzPublishCoreBundle\Imagine\ImageAsset
Definition: ImageAsset/AliasGenerator.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.