Closed sjelfull closed 3 years ago
I have added a custom type field named imgix to AssetInterface through the TypeManager::EVENT_DEFINE_GQL_TYPE_FIELDS event like this:
imgix
AssetInterface
TypeManager::EVENT_DEFINE_GQL_TYPE_FIELDS
Event::on( TypeManager::class, TypeManager::EVENT_DEFINE_GQL_TYPE_FIELDS, function(DefineGqlTypeFieldsEvent $event) { if (in_array($event->typeName, self::GQL_ELEMENT_INTERFACES, true)) { $event->fields['imgix'] = [ 'name' => 'imgix', 'type' => ImgixInterface::getType(), 'args' => ImgixArguments::getArguments(), 'resolve' => ImgixResolver::class . '::resolve', 'description' => 'This query is used to query for Imgix meta data.', ]; } });
This has been working well with the gatsby-source-graphql source, and I have been using it like this:
gatsby-source-graphql
imgix(maxWidth: 800, maxHeight: 800, quality: 100) {...}
After installing gatsby-source-craft, I still see the custom type (imgix) on AssetInterface, but it doesn't list any of the params.
gatsby-source-craft
Now, I read the section about Integrating Third-Party Content, but this seems to apply only to source nodes?
Do I need to do anything else for the source to pick them up?
As discussed on Discord with @sjelfull - this is best-resolved by using custom fragments.
Description
I have added a custom type field named
imgix
toAssetInterface
through theTypeManager::EVENT_DEFINE_GQL_TYPE_FIELDS
event like this:This has been working well with the
gatsby-source-graphql
source, and I have been using it like this:After installing
gatsby-source-craft
, I still see the custom type (imgix
) onAssetInterface
, but it doesn't list any of the params.Now, I read the section about Integrating Third-Party Content, but this seems to apply only to source nodes?
Do I need to do anything else for the source to pick them up?
Additional info