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.
Well, that's mostly it. I want to build a view where given a taxonomy, term the content under that taxonomy term and under all of the taxonomy related terms appear. Any help will be welcome!
I can not find a proper way to buil it on my own with the current views, and I'm not a php programmer so... :-(
Comment | File | Size | Author |
---|---|---|---|
#14 | view_with_related_terms.txt | 4.81 KB | GiorgosK |
Comments
Comment #1
dawehnerWhat is your definition of related terms? I don' know such a name in standard-drupal.
Comment #2
kiko CreditAttribution: kiko commentedTaxonomy terms have two major extensions: synonyms and related terms. For each term you can define its related terms via e.g. Taxonomy manager.
I have now two terms: term1 and rterm2. I define a relation between term1 and rterm2. I'd like to show all the nodes tagged under term1 or rterm2 when I call to taxonomy/term/term1
K
Comment #3
dawehnerUps, i didn't read the issue enough :)
You can use views argument validation php code
Perhaps you have to rewrite the code to use it for term-names not tids.
Comment #4
gagarine CreditAttribution: gagarine commentedHello,
Can i do something similar with filter instead of argument?
Thanks
Comment #5
Dimm CreditAttribution: Dimm commentedComment #6
Faya CreditAttribution: Faya commentedThanks for this
Comment #7
GiorgosK@Dimm
where do I put this validation code from #5 ?
EDIT: I suppose you add arguments (from the Views UI)
but for what kind of argument (taxonomy term perhaps ?)
and what settings go in there ?
Comment #8
kiko CreditAttribution: kiko commentedHi again
This code almost seem to work, but... What I've done is:
1.- Add a "Taxonomy: Term ID" argument
2.-Validator: PHP Code with the code:
3.- Save
The code seems to capture all the related arguments, but only the first one is passed to the view. I've tried both, checking and unchecking the option "Allow multiple terms per argument" and "Allow multiple arguments to work together", but nothing happens
Any idea?
Comment #9
kiko CreditAttribution: kiko commentedAlmost solved. The idea is to add a "+" to the implode function, more than a ",". Probably my fault explaining it, I wanted to list everything under a taxonomy term OR its related terms. The code is finally:
But one problem remains. I can list everything under the related terms, but not those listed under the term itself. Any idea?
Thanks in advance
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commentedTry this:
You can make this a bit less code like this:
Comment #11
kiko CreditAttribution: kiko commentedIt works!
Thanks a lot indeed!
Comment #12
dawehnerSo this is fixed. Anyone want to write some documentation?
Comment #13
kiko CreditAttribution: kiko commentedDone: http://drupal.org/node/648462
Comment #14
GiorgosKI have done as described above but when I use exposed (or even non exposed) filter to view nodes of certain term I don't get the related term nodes
here is an export of a very basic view
what am I doing wrong ?
Comment #15
kiko CreditAttribution: kiko commentedI think the problem is that this method works properly with arguments introduced via URL (e.g. www.example.com/taxonomy/term/%), but not with filters.
Comment #17
kiko CreditAttribution: kiko commentedI'm changing this issue to open as I'd like to know if there's some way to add this capability to an exposed views filter. I have searched quite a lot but I couldn't find the answer.
Thanks in advance
Comment #18
dawehnerWhat do you mean with this?
Open a new one, if you can explain what you want.
Comment #19
kiko CreditAttribution: kiko commentedOK. opening a new one