From a0fb7d4a6e55b0b301626019e648bda8406b8cd8 Mon Sep 17 00:00:00 2001 From: Nathaniel Hammond Date: Wed, 21 Aug 2024 10:57:20 +0100 Subject: [PATCH] Fixed #15572 GQL not allowing overriding named transforms --- CHANGELOG.md | 1 + src/helpers/Gql.php | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 328801df9b0..b65bdf6ea35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fixed a bug where admin tables weren’t displaying disabled statuses. ([#15540](https://github.com/craftcms/cms/pull/15540)) - Fixed a JavaScript error that occurred when adding a row to an editable table that didn’t allow reordering rows. ([#15543](https://github.com/craftcms/cms/issues/15543)) - Fixed an error that occurred when editing an element with a Link field previously set to a URL value, if the field no longer allows URLs. ([#15542](https://github.com/craftcms/cms/issues/15542)) +- Fixed a bug where it wasn’t possible to override named transforms in GraphQL queries. ([#15572](https://github.com/craftcms/cms/issues/15572)) ## 5.3.4 - 2024-08-13 diff --git a/src/helpers/Gql.php b/src/helpers/Gql.php index 9d7051d0dba..887a88ba6d5 100644 --- a/src/helpers/Gql.php +++ b/src/helpers/Gql.php @@ -385,15 +385,13 @@ public static function prepareTransformArguments(array $arguments): array|string { unset($arguments['immediately']); - if (!empty($arguments['handle'])) { - $transform = $arguments['handle']; - } elseif (!empty($arguments['transform'])) { - $transform = $arguments['transform']; - } else { - $transform = $arguments; + // Remap handle to transform to work with image transform normalization + if (isset($arguments['handle'])) { + $arguments['transform'] = $arguments['handle']; + unset($arguments['handle']); } - return $transform; + return $arguments; } /**