Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ env:
PIMCORE_PROJECT_ROOT: ${{ github.workspace }}
PRIVATE_REPO: ${{ github.event.repository.private }}

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
setup-matrix:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ env:
PIMCORE_PROJECT_ROOT: ${{ github.workspace }}
PRIVATE_REPO: ${{ github.event.repository.private }}

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
setup-matrix:
runs-on: ubuntu-latest
Expand Down
25 changes: 20 additions & 5 deletions src/GraphQL/Resolver/AssetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ public function resolveEmbeddedMetaInfo($value = null, $args = [], $context = []
public function resolvePath($value = null, $args = [], $context = [], ?ResolveInfo $resolveInfo = null)
{
$asset = $this->getAssetFromValue($value, $context);
if (!$asset) {
return null;
}

$thumbNailConfig = $args['thumbnail'] ?? null;
$thumbNailFormat = $args['format'] ?? null;
$deferred = $args['deferred'] ?? false;
Expand All @@ -175,6 +179,9 @@ public function resolvePath($value = null, $args = [], $context = [], ?ResolveIn
public function resolveData($value = null, $args = [], $context = [], ?ResolveInfo $resolveInfo = null)
{
$asset = $this->getAssetFromValue($value, $context);
if (!$asset) {
return null;
}
$thumbNailConfig = $args['thumbnail'] ?? null;
$thumbNailFormat = $args['format'] ?? null;
$deferred = $args['deferred'] ?? false;
Expand All @@ -200,12 +207,13 @@ public function resolveData($value = null, $args = [], $context = [], ?ResolveIn
public function resolveSrcSet($value = null, $args = [], $context = [], ?ResolveInfo $resolveInfo = null)
{
$asset = $this->getAssetFromValue($value, $context);
$thumbNailConfig = $args['thumbnail'] ?? null;
$thumbNailFormat = $args['format'] ?? null;
$deferred = $args['deferred'] ?? null;
$assetFieldHelper = $this->getGraphQLService()->getAssetFieldHelper();

if ($asset instanceof Asset\Image) {
$thumbNailConfig = $args['thumbnail'] ?? null;
$thumbNailFormat = $args['format'] ?? null;
$deferred = $args['deferred'] ?? null;
$assetFieldHelper = $this->getGraphQLService()->getAssetFieldHelper();

$mediaQueries = [];
$thumbnail = $assetFieldHelper->getAssetThumbnail($asset, $thumbNailConfig, $thumbNailFormat, $deferred);
$thumbnailConfig = $asset->getThumbnail($args['thumbnail'], $deferred)->getConfig();
Expand Down Expand Up @@ -267,8 +275,12 @@ public function resolveResolutions($value = null, $args = [], $context = [], ?Re
$thumbnailFormat = $args['format'] ?? null;
$assetFieldHelper = $this->getGraphQLService()->getAssetFieldHelper();

/** @var Asset\Image $asset */
/** @var Asset\Image|null $asset */
$asset = $this->getAssetFromValue($value, $context);
if (!$asset) {
return null;
}

$thumbnail = $assetFieldHelper->getAssetThumbnail($asset, $thumbnailName, $thumbnailFormat);
if (isset($thumbnail)) {
$thumbnailConfig = $thumbnail->getConfig();
Expand Down Expand Up @@ -303,6 +315,9 @@ public function resolveDimensions($value = null, $args = [], $context = [], ?Res
if ($value instanceof ElementDescriptor) {
$thumbnailName = $args['thumbnail'] ?? null;
$asset = $this->getAssetFromValue($value, $context);
if (!$asset) {
return null;
}

if ($asset instanceof Asset\Video) {
$width = $asset->getCustomSetting('videoWidth');
Expand Down