Usage example for this default argument plugin

This module provides a default plugin argument for views, with which you can get the parent terms associated with the current node.

It is very useful to get related content from a higher taxonomic level.

Using it in conjunction with the argument "Taxonomy Term: Parent Term" you can get all those nodes for which the parent node's terms is the same as in the current node.

You can get this argument creating the relationship "Content: Taxonomy terms on node"

Example use case

Suppose we have a Taxonomy Tree like these:

|- Parent_Term_1
|--- Term_A -- Associated to Node_1 and Node_2
|--- Term_B -- Associated to Node_3
|--- Term_C -- Associated to Node_4, Node_5 and Node_6
|
|- Parent_Term_2
|--- Term_Z
|--- Term_Y
|
|- Parent_Term_3
|--- Term_J
|--- Term_K
|--- Term_L

Views provide a custom default argument to get content related to taxonomy
terms associated to current node. In the example above, Node_3 would not have
related content, Node_1 would have Node_2 as related content and Node_4 would
have Node_5 and Node_6 as related content.

However, this module provides another default plugin argument, to get
associated parent terms. In the example above, Node_3 would have all nodes as
related content. Is useful when there are few content associated with a
taxonomy term.

Steps

  1. Get this module using git clone and on a drupal 7 distribution.
  2. Enable module Views parent term default argument.
  3. Edit/Create a view and add a relationship with "Content: Taxonomy terms on node" and select at least one vocabulary.
  4. Add contextual filter "Taxonomy term: Parent term", and make sure is using the relationship created previously.
  5. In filter configuration, select "Provide default value" in "When the filter value is NOT available" fieldset.
  6. Select "Taxonomy parent term ID from URL" as "Type".
  7. Uncheck "Load default filter from term page" option.
  8. Check "Load default filter from node page, that's good for related taxonomy blocks" option and limit terms by vocabulary if necessary.
  9. If you want to show content related to more than one parent term, be sure that option "Allow multiple values" is enabled on "More" fieldset.

New in 1.1 version

New feature from Issue #1553638 (http://drupal.org/node/1553638):
Added additional option to get content from root parent terms.
View the issue for more info.

Project Information

Downloads