diff --git a/CHANGELOG.md b/CHANGELOG.md index 621d8cac2a6..1c86eba56c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fixed a bug where Money fields’ min, max, and default values weren’t being set to the correct currency. ([#15565](https://github.com/craftcms/cms/issues/15565), [#15566](https://github.com/craftcms/cms/pull/15566)) - Fixed a bug where Money fields weren’t handling negative values correctly. ([#15565](https://github.com/craftcms/cms/issues/15565), [#15567](https://github.com/craftcms/cms/pull/15567)) - Fixed a bug where PHP-originated Craft Console API requests weren’t timing out if the API was down. ([#15571](https://github.com/craftcms/cms/pull/15571)) +- Fixed a bug where it wasn’t possible to override named transforms in GraphQL queries. ([#15572](https://github.com/craftcms/cms/issues/15572)) - 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)) 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; } /** diff --git a/tests/unit/gql/ElementFieldResolverTest.php b/tests/unit/gql/ElementFieldResolverTest.php index 975855d6098..7818c3a2909 100644 --- a/tests/unit/gql/ElementFieldResolverTest.php +++ b/tests/unit/gql/ElementFieldResolverTest.php @@ -450,8 +450,9 @@ public static function assetTransformDataProvider(): array [['width' => 200, 'height' => 200], ['width' => 200, 'height' => 200]], [['width' => 400, 'height' => 200], ['width' => 400, 'height' => 200]], [['width' => 200, 'height' => 500], ['width' => 200, 'height' => 500]], - [['width' => 200, 'height' => 200, 'handle' => 'testHandle'], ['handle' => 'testHandle']], - [['width' => 200, 'height' => 200, 'transform' => 'testHandle2'], ['handle' => 'testHandle2']], + // Overriding named transforms + [['width' => 200, 'height' => 200, 'handle' => 'testHandle'], ['handle' => null, 'width' => 200, 'height' => 200]], + [['width' => 200, 'height' => 200, 'transform' => 'testHandle2'], ['handle' => null, 'width' => 200, 'height' => 200]], ]; } }