Skip to content

Instantly share code, notes, and snippets.

@maxime-rainville
Created December 5, 2023 23:34
Show Gist options
  • Save maxime-rainville/cf52ac57469084cc0102a6a3a101c597 to your computer and use it in GitHub Desktop.
Save maxime-rainville/cf52ac57469084cc0102a6a3a101c597 to your computer and use it in GitHub Desktop.
Example of how to overide asset-admin GraphQL
# app/_graphql/types/Folder.yml
# This will be merged with vendor/silverstripe/asset-admin/_graphql/types/Folder.yml
Folder:
fields:
'children(filter: FileFilterInput)':
type: '[FileInterface]'
plugins:
sorter:
# If we used the array syntax (e.g. [MyFolderTypeResolver, sortChildren]),
# it will be merged with the pre-existing value. By using the string
# callabale syntax, we'll override the existing value instead
resolver: 'MyFolderTypeResolver::sortChildren'
# app/_config/graphql.yml
# This will be merged with the content of vendor/silverstripe/asset-admin/_config/graphql.yml
# The actual source src for your admin schema will be something like this
# - assetAdmin: 'silverstripe/asset-admin: _graphql'
# - myAssetAdmin: 'app/_graphql'
---
Name: my-asset-admin-graphql
After:
- '#asset-admin-graphql'
---
SilverStripe\GraphQL\Schema\Schema:
schemas:
admin:
src:
myAssetAdmin: 'app/_graphql'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment