In Drupal, out of all the modules available for all kinds of tasks, there are certain modules; that no matter what kind of project we are working on; we are always using them. A very good example of this kind of module is the Views Module, a module so important that is going to be included in the Drupal Core Version 8.
In this case, we have a "content type" and 3 different taxonomy vocabularies using 2 levels of hierarchy. The 3 types of taxonomies can be applied to a single node.
The vocabularies are used as menus to filter the results.
Taxonomy Vocuabulary 1
Taxonomy Vocuabulary 2
Taxonomy Vocuabulary 3
Therefore when it’s time to create a node, it may have 1 or various terms related to the node and those same terms could repeat in 1 or various nodes of the same type of content.
The url will always be view/parent/child depending on the term we consulted, therefore we should add the % to the path option, that will indicate the position of the contextual filters.
When adding the contextual filters we will be tempted to add the father as the first filter, however we do not need it , because if we check the tables on the data base for the taxonomies, the data base will save the hierarchy of each term.
Since these data is already on the data base, we do not need it, therefore the first filter will be Global:null
For our second filter we will use the name that comes in the field # 3 of our URL view/parent/>child< and we will use the filter Content: Has taxonomy term ID and we are going to tell him to look for in the URL
Now it may happen in some cases, that the consultation goes wrong due to the fact that in this case there are some terms that have the same name, therefore in order for us to prevent this from happening, we will tell him to replace the name of the URL for the ID
And with this we can already filter the tid according to the URL, and that it doesn’t consult by the given name the URL.
Copyright © 2015 - 2017 - ParallelDevs