diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb5375..a5c887d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## Unreleased + +### Fixed +- Fixed an error that occurred when executing a GraphQL query if a Width field existed in the Craft install + ## 4.1.0 - 2022-10-20 ### Added diff --git a/src/fields/Width.php b/src/fields/Width.php index 0d6429b..f0d145f 100755 --- a/src/fields/Width.php +++ b/src/fields/Width.php @@ -8,6 +8,7 @@ use craft\fields\Dropdown; use craft\helpers\Cp; use craft\helpers\Json; +use GraphQL\Type\Definition\Type; use spicyweb\oddsandends\fields\data\WidthData; use yii\db\Schema; @@ -183,6 +184,22 @@ public function validateOptions(): void } } + /** + * @inheritdoc + */ + public function getContentGqlMutationArgumentType(): Type|array + { + // Using the code from \craft\base\Field::getContentGqlMutationArgumentType() due to an error that was occurring + // with GraphQL queries. + // TODO: either extend something other than Dropdown, or figure out another way to avoid the error and let this + // field type support GraphQL mutations. + return [ + 'name' => $this->handle, + 'type' => Type::string(), + 'description' => $this->instructions, + ]; + } + /** * @inheritdoc */