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.
We have a view for taxonomy pages for which we have the path /taxonomy/term/% so that we can pass the termid to the contextual filters:
We use a global filter to pass that to the same view, but this doesn't work because of the percent sign, as your readme clearly states "Make sure that under "Page Settings" the Path does NOT contain percent signs for arguments that you wish to apply a Global Filter to."
So, I understand it doesn't work by design, but is there a workaround to let them work together?
Comment | File | Size | Author |
---|---|---|---|
sdb98hw4hsnsdb.jpg | 197.99 KB | flbr | |
Z7vDBBx.png | 5.07 KB | flbr |
Comments
Comment #1
RdeBoerHi flbr,
I read my own README and found it is not very clear. So I've just checked into the repository a new version (7.x-1.x-dev) of the module with some code enhancements and this updated section of the README:
In the context of your /taxonomy/term/% view this means that all you have to do is remove that last /% from the view's Path. This then opens up a slot for the global filter to do its thing.
Normally global filters should be the last ones in the list of contextual filters. However, the "Has taxonomy term ID depth modifier" contextual filter is special and can stay where it is.
BUT....
There is a second issue with the /taxonomy/term/% view... It doesn't use real fields as contextual filters. These "Has taxonomy term ID" contextual filters are kind of global... They operate on taxonomies, but they are not taxonomy fields attached to specific content types, which is what Views Global Filter needs.
So I've improved the code to also offer "Has taxonomy term ID" and "Has taxonomy term ID with depth" as options in a global filter block.
This should get you started with your /taxonomy/term view. Take Global Filter 7.x-1.x-dev for a spin. Only the textfield widget is available at the moment. I'd like to learn, through your testing ;-) whether the new extensions are functionally correct before I put effort in a drop-down select or autocomplete.
If you do not wish your users to type in term ids into the textfield, proceed as follows on the contextual filter configuration pane:
Under WHEN THE FILTER VALUE IS IN THE URL OR A DEFAULT IS PROVIDED
Tick: "Specify validation criteria"
Validator: "Taxonomy term"
Filter value type: "Term name converted to term ID"
Now you can type term NAMEs rather than numbers into the global filter box.
Rik
Comment #2
flbr CreditAttribution: flbr commentedHi Rik,
Thank you so much for your elaborate response. I don't understand all of it, though. I don't want to use the taxonomy term as a global filter, I mean, I don't want users to have to fill in a field to show a taxonomy page.
When I remove the %-sign, the page changes and shows all nodes in that taxonomy-term in full content. So, not only the teasers, but the full body text.
If I understand this correctly: "So, if you have one normal contextual filter, followed by one global filter, you'll have one percent sign. ", shouldn't I have two percent signs, because I have two normal contextual filters ("Inhoud: Has taxonomy term ID (with depth)" and "Inhoud: Has taxonomy term ID depth modifier") before one global filter? But that causes the same display issues: showing full nodes on the page.
To be clear: we use this view to have http://www.endandit.nl/tech to show the nodes of http://www.endandit.nl/taxonomy/term/18 . The aim is to have a global filter (which is controled by the button in the upper right "UIT") that is used to filter the nodes on a field value.
I would be more than happy to give you access to the system if this helps.
Cheers,
Gert
Comment #3
RdeBoerHi Gert,
Yes access to your system would be good. And maybe a concrete example of what is supposed to happen when a user clicks/enters something where.
You can contact me personally for that if you wish and we can report a summary back here in this thread.
Rik