Skip to content

Commit 9ebf172

Browse files
authored
Merge pull request #15 from bdunogier/fix_image_variations
Fixed image variations resolution
2 parents 5c030e9 + 3fd2771 commit 9ebf172

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

GraphQL/Resolver/ImageFieldResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public function __construct(VariationHandler $variationHandler, ContentService $
3636
public function resolveImageVariation(ImageFieldValue $fieldValue, $args)
3737
{
3838
$idArray = explode('-', $fieldValue->imageId);
39-
if (count($idArray) != 2) {
39+
if (count($idArray) != 3) {
4040
throw new UserError("Invalid image ID {$fieldValue->imageId}");
4141
}
42-
list($contentId, $fieldId) = $idArray;
42+
list($contentId, $fieldId, $versionNumber) = $idArray;
4343

44-
$content = $this->contentService->loadContent($contentId);
44+
$content = $this->contentService->loadContent($contentId, [], $versionNumber);
4545

4646
$fieldFound = false;
4747
/** @var $field \eZ\Publish\API\Repository\Values\Content\Field */

Resources/config/graphql/Field.types.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ImageFieldValue:
8181
identifier:
8282
type: "[String]"
8383
description: "One or more variation identifiers."
84-
resolve: "@=resolver('ImageVariation', [value, args])"
84+
resolve: "@=resolver('ImageVariation', [value.value, args])"
8585
interfaces: [FieldValue]
8686

8787
ImageVariation:

0 commit comments

Comments
 (0)