Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The WHERE
clause generated by a contextual filters is always grouped with the first "and/or" group of static filters. Thus the order of the "and/or" filter-groups is significant, and re-ordering them changes the semantic of contextual filter(s) entirely—not just how it is rendered into a SQL query.
Is this a bug?
If it is a feature, might the feature change or be removed in the future? Since the GUI does not communicate this at all, is it documented anywhere?
If there are multiple contextual filters, they can not be assigned to different "and/or" groups. Is that a bug?
Comment | File | Size | Author |
---|---|---|---|
#4 | 1242424-document_contextual_filter_grouping.patch | 1.22 KB | Bevan |
Comments
Comment #1
dawehnerWell that's currently a know behaviour and would probably require to edit all argument handlers.
In general this would be solved one day by using #357082: Pull filter value from an argument? because then you can move around your filters/filters prefilled with arguments as you wish.
Feel free to document the current behaviour.
Just to clarify this, you are right, this is not possible at the moment.
The underlying problem is that in handler/views_handler_argument.inc $this->add_where(0, ...) is done.
Comment #2
Bevan CreditAttribution: Bevan commentedDoes #357082 add a UI for ordering and grouping contextual filters? That is the best place to document this behaviour.
In the meantime, where would be a good place to document the current behaviour? Or is this just duplicate?
Comment #3
dawehner#357082: Pull filter value from an argument? will allow to pull filter values from arguments.
So basically you sort/or-sort the filters as before. Perhaps help/argument.html is the right place to document it.
Comment #4
Bevan CreditAttribution: Bevan commentedThe attached patch adds the following documentation to
help/argument.html
:Comment #5
dawehnerThanks for clarifing this!
Commited to 7.x-3.x
Comment #7
jackbravo CreditAttribution: jackbravo commentedI believe this is no longer the case. I created a view. Added two contextual filters and two normal filters. On the filter and/or interface I set the filters to be in just one group and separated by or. On my query this is how the filters appear (this is a term view):
(I added two taxonomy vocabulary filters just so it would be easier). So the documentation seems to be wrong.
Comment #8
Bevan CreditAttribution: Bevan commentedPlease open a new issue if you think the documentation is no longer correct. You can link to this one if you like.