3

I am trying to figure out if there is a way to modify the default taxonomy view so it shows nodes tagged with that particular term (already done) plus all children of the taxonomy term you are viewing.

I have seen solutions for D7 but nothing for D8.

1

1 Answer 1

1

One way of doing this is with the use of https://www.drupal.org/project/eva which lets you attach any entity to any other entity

Just for demonstration I have setup

parent 1
  child 1.1
  child 1.2
parent 2
  child 2.1
  child 2.2

install and enable eva create a taxonomy terms view called children with no block or page display

create taxonomy view

Then add an EVA views display from the dropdown You will need to set a contextual filter parent term with following settings

Hide when value not available 
specify validation criteria 
   taxonomy term id: 
      [NAME-OF-VOCABULARY]
   hide view 

contextual filter settings

and on entity content settings set entity type: taxonomy term and bundle: [vocabulary name]

taxonomy term children view

I had to clear cache so it does not hurt to do it and visit any of the taxonomy parent pages you should see the children terms

parent and children terms

you can change where the children are displayed at your taxonomy term display settings page

enter image description here

6
  • Thank you for this detailed answer. This should work I think. Hopefully there is no issues with the TVI module which I used to take over taxonomy term page.
    – Progonat
    Nov 3, 2017 at 13:28
  • you are welcome ... I don't think it will have any problem cooperating with TVI.
    – GiorgosK
    Nov 3, 2017 at 14:03
  • Just set up the view exactly like yours. My only question is what did you use for Taxonomy term: Parent term validation? Currently, I have When the filter value is not available - Provide default value - Type Taxonomy term ID from URL. This is not working for me.
    – Progonat
    Nov 3, 2017 at 14:22
  • revised the answer please check
    – GiorgosK
    Nov 3, 2017 at 15:26
  • Perfect. It worked on a fresh Drupal install. Not working on my production site, but I will have to figure that out.
    – Progonat
    Nov 3, 2017 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.