Skip to content

Commit

Permalink
chore: Add mockup support for asset srcset
Browse files Browse the repository at this point in the history
  • Loading branch information
das-peter committed Aug 19, 2024
1 parent b81b486 commit 58cc728
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/GraphQL/Resolver/AssetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ public function resolveSrcSet($value = null, $args = [], $context = [], ResolveI
$thumbNailConfig = $args['thumbnail'] ?? null;
$thumbNailFormat = $args['format'] ?? null;
$assetFieldHelper = $this->getGraphQLService()->getAssetFieldHelper();
// Check if the value was already resolved in a mockup object.
$returnName = $resolveInfo->fieldNodes[0]?->alias?->value ?? $resolveInfo->fieldName;
if ($asset instanceof ElementMockupInterface) {
if (isset($value[$returnName])) {
return $value[$returnName];
}
$asset = $asset->getOriginalObject();
}

if ($asset instanceof Asset\Image) {
$mediaQueries = [];
Expand Down

0 comments on commit 58cc728

Please sign in to comment.