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.
Hi all,
Views has only parent selection Relationship. Why not having child Relationship?
Providing simple patch for that.
Use case
Products catalog of fixed-level depth, where products are tagged with lowest level terms (leafs). And now need to output the products, divided into categories, say - price-list.
1) Create a taxonomy View
2) Add Contextual filter for Parent Term, and set Fixed value = 0 (to select only root of the tree)
3) Add this new Relationship - Child terms.
4) Repeat (3) until low-level reached
5) Add Taxonomy content Relationship to select products.
6) PROFIT!
Comment | File | Size | Author |
---|---|---|---|
#17 | views-term_child_relationship-1437494-17.patch | 1.04 KB | frob |
#13 | views-term_child_relationship-1437494-4.patch | 1.14 KB | OnkelTem |
| |||
#9 | features-drupal_static_reset-2.patch | 770 bytes | OnkelTem |
| |||
#4 | views-term_child_relationship-1437494-4.patch | 1.14 KB | erikwebb |
adding_child_terms_relationship.patch | 1.16 KB | OnkelTem | |
Comments
Comment #1
liquidcms CreditAttribution: liquidcms commentedthanks for this; seems to be just what was needed. odd this wasn't there already.
Comment #3
fehin CreditAttribution: fehin commentedThis sounds like a great idea.
Comment #4
erikwebb CreditAttribution: erikwebb commentedComment #5
philipz CreditAttribution: philipz commentedWow after such long time and just when I thought about it here it is :) Thanks! It works for me fine.
Now if only I could select this relationship in representative node relationship this would be awesome. I'll open a new issue for that and link to patch #4.My mistake - relationship order matters :)
Comment #6
TimelessDomain CreditAttribution: TimelessDomain commentedComment #7
Summit CreditAttribution: Summit commentedHi,
Could like this also child terms for node-views be build?
Greetings, Martijn
Comment #8
colanWe've recently switched our testing from the old qa.drupal.org to DrupalCI. Because of a bug in the new system, #2623840: Views (D7) patches not being tested, older patches must be re-uploaded. On re-uploading the patch, please set the status to "Needs Review" so that the test bot will add it to its queue.
If all tests pass, change the Status back to "Reviewed & tested by the community". We'll most likely commit the patch immediately without having to go through another round of peer review.
We apologize for the trouble, and appreciate your patience.
Comment #9
OnkelTem CreditAttribution: OnkelTem as a volunteer commentedComment #10
OnkelTem CreditAttribution: OnkelTem as a volunteer commented@colan what is it waiting for? (no testing)
Comment #11
colanTests don't run until the branch passes on its own. We just got it to pass again now so it looks like all of the tests are automatically re-queueing. There will be a large number of them now so please be patient.
Comment #13
OnkelTem CreditAttribution: OnkelTem as a volunteer commentedOh, crap, I've uploaded the wrong patch :)
Uploading again, the #4th by erikwebb
Comment #14
ibis CreditAttribution: ibis commentedWorks very well to select only parent terms what have content even only on children term! And the grouped by count-distinct on the related node-ids gives count of all content from childrens. Thanks!
Comment #15
demonde CreditAttribution: demonde commentedWorks very well. When will it be contributed to dev?
Comment #16
darrenwh CreditAttribution: darrenwh as a volunteer and at Investis Digital commentedI don't think this comment is in line with DCS? perhaps omit -----?
Should capitalise first letter and add a period (.) at end.
Comment #17
frobRerolled patch to better conform to Drupal Coding standards for documentation.