Views Argument "Primary Term" only recognized TID, not term name
| Project: | Primary Term |
| Version: | 5.x-1.2 |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Would be great to add a views argument for this module "Primary Term: Term Name" and change the current from "Primary Term" to "Primary Term: Term ID".
The following code inserted into the custom argument handling with the existing "Primary Term" argument did the trick for me:
if ($term = taxonomy_get_term_by_name(arg(1))) {
return array($term[0]->tid);
}The use case is that you have a view with the url "mysite.com/foo" and you have primary terms in use for "bar" where tid is 1
without this custom argument handling code, to see all nodes with primary term "bar" you would have to visit url "mysite.com/foo/1"
WITH this custom argument handling you can visit "mysite.com/foo/bar". also when view is included in a panel where term name is appended to panel url, view will properly process and return results.
