Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The attached patch adds a hook to _taxonomy_menu_trails_get_path(). This allows other modules to provide any kind of mapping for terms of a given id.
Example use cases:
- You have a view of all nodes of a given term id And want to keep the menu trail to that view.
- You have a node with an explicit list of other nodes, which all have the same trail.
- Whatever :)
Comment | File | Size | Author |
---|---|---|---|
taxonomy_get_path_hook.patch | 1.63 KB | Berdir |
Comments
Comment #1
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedThanks for patch. Looks good! Except for
$vids
variable, which depends on "tm_integration" option enabled. Probably, we should:Comment #2
Summit CreditAttribution: Summit commentedThis would be awesome to have it also working on views!
Greetings, Martijn
Comment #3
Dmitriy.trt CreditAttribution: Dmitriy.trt commented2 Summit:
Do you mean node detection on non-default paths (for example, view with nid argument)? It is already released, see #1129760: Custom paths to nodes.
If not, please explain.
Comment #4
BerdirClarification of my patch/this issue:
My patch is actually the reverse of the linked issue, if I understood it correctly.
The other issue is about supporting different "source" paths.
My patch is about supporting other things than the default node -> term mapping. In our case where I needed this, it was related to terms, but not the default taxonomy_term page (or a view override of that), but custom node pages which had a list of other nodes (which happened to share the same term, but the page has been manually created).
Basically, it is possible to define *any* mapping you can think of (e.g. a view, another node that references this one with a node reference field, the author of the node, ...). This kinda breaks the Taxonomy part in "Taxonomy Menu Trails", though :)
Comment #5
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedA bit different hook is now defined in TMT. See taxonomy_menu_trails.api.php.
Dev version will be packaged in the next 12 hours.