2

When using Content: Nid as a contextual filter for "Content" (node) type views, I can check "Override title" and use %1, and the node id will be converted to the real node title when displaying this title. (For example, I can type "Gallery of %1", and it will be converted to "Gallery of Blablabla".)

When I create a view for showing "Taxonomy Terms", set "Taxonomy term: Term ID" as a contextual filter, check "Override title", and use %1 the same way I did for "Content", the taxonomy id doesn't get converted to the real name of the term! (so for example "term is %1" gets converted to "term is 261", which is not the expected result)

screenshot

screenshot

Why, and how can I get around this problem? I'd like to override the title and use the taxonomy term name.

  • Have you tried adding that title in field list? – Ashish Nov 5 '12 at 8:09
  • Have you tried specifying the validation criteria with term name to Term id? – Tyler Durden Nov 5 '12 at 10:27
4

It works for me with Drupal 7.

What I did was enabling the validation criteria, set the validator to Taxonomy term, and the type of the filter value to Term ID.

screenshot

When I visit http://example.com/programming-languages I get the list of all the taxonomy terms terms for the "Programming languages" vocabulary.

screenshot

When I visit http://example.com/programming-languages/20, I get a page using the overridden title.

screenshot

  • wow, this is really surprising to me, but checking "Specify validation criteria" > "Taxonomy term" > checking the given vocabulary, setting "Filter value type" to "Term ID" really solved it! Thank you, kiamlaluno! :) I was surprised, because when setting "Content: Nid", I don't have to check this to make this conversion work automatically. If you know the reasons why, share it please! Anyway, your answer is accepted, thanks again! – Sk8erPeter Nov 5 '12 at 15:58
  • Neat - I didn't know using a validator would change the title behavior. – googletorp Nov 5 '12 at 20:43
  • @Sk8erPeter I tried to find an explanation by looking at the documentation for Views on Drupal API, but I didn't find much. I can only guess that by default the validation criteria is not able to understand the passed ID is the taxonomy term ID, and not another ID, such as the vocabulary ID. It doesn't explain much, as for a node there are revision IDs, and for a user there are role IDs. I am not sure why for a taxonomy term the argument should not be understood as taxonomy term ID. – kiamlaluno Nov 5 '12 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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