statamic / docs

Statamic Documentation
https://statamic.dev
Other
105 stars 367 forks source link

The use of Query Scope could be explained more clearly. #1335

Closed simonbedard12 closed 2 months ago

simonbedard12 commented 2 months ago

For the Query Scope to function inside the collection tag, it must be called using the underscore syntax, even if the class name uses camel case, which is fine.

query_scope-2

Only the one on the left is working

However, this could be more explicitly stated in the documentation.

https://statamic.dev/fieldtypes/entries#options https://statamic.dev/extending/query-scopes-and-filters#scopes

Additionally, the default PHP comment could be updated to provide an example when creating a scope with the CLI command php please make:scope.

/*
* @use: my_query_scope
/*
class MyQueryScope extends Scope{
...
duncanmcclean commented 2 months ago

This will be improved by statamic/cms#9933, which will allow you to select from available query scopes in your app, without needing to manually specify their handles.