-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative QueryController approach #1473
Conversation
b4056ff
to
84d6c9f
Compare
Nitpick: Doesn't look like it has anything to do with https://jira.ez.no/browse/EZP-24264 : LDAP authentication ;) |
Thank you @joaoinacio :) |
I think this is right direction, even if there are some things that don't appear clear, like how queryParameters is translated to a query, and how the convention is. Also would like to see how this might look with a built in children query type to make sure this can be used as opposed to creating a specific one per type. Sane defaults would also be great to avoid having to specify everything, for instance variable being "list" by default |
Added an example in the last commit, @andrerom. |
thanks, and great to see it handling sorting based on the location transparently, a developer itch with the Search API from several. |
"itch" is a good choice of words :-) |
e5adfd9
to
f346e1f
Compare
Side: On that topic I still think Location Search API should have taken Location as an argument somehow as well to either do list (children) or tree searches, if so it could take sorting into account even down there. This was a longer discussion on this back when it was added, but this got labeled as the "higher level api" for later, and here we are I guess. |
Entries from params.queryParameter will be searched for values starting with '@=' (standard expression language syntax in yaml). The expressions will be processed by the QueryController, and have access to: - `view`: the ContentView - `content`: the rendered Content - `location`: the rendered Location, if any This expression would pass the location id as the parentLocationId queryParameter: ``` params: queryParameters: parentLocationId: @=location.id ```
f346e1f
to
6471620
Compare
Will reopen with a cleaned up version. |
This is an alternative approach to what was done in #1460.
The goal is still to facilitate viewing of a list of content / locations. #1460 was based on a new "view" (as in content view or block view), where a QueryType got executed, and the results assigned to a template. But upon implementation, it appeared to be tedious, on simple use cases like a list of children.
In this approach, a built-in
QueryController
is added. It can be used in anycontent_view
config to add the results of aQueryType
to the view:The view is configured to use
ez_query:contentAction
. The controller action runs the QueryType specified asquery
, and sets the results to the variable specified asvariable
.The elements from
queryParameters
are passed to the QueryType'sgetQuery()
method.The expression language can be used in any queryParameter by prefixing the value with
@=
. The expression is given theview
, thelocation
and thecontent
. This makes it easy to pass any property from those value objects to generate the query.The
enable_pager
parameter (not implemented yet) will pass the search results as a PagerFanta pager object. If set to false, an array will be passed instead.TODO