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 :)

Files: 
CommentFileSizeAuthor
taxonomy_get_path_hook.patch1.63 KBBerdir

Comments

Status:Needs review» Needs work

Thanks for patch. Looks good! Except for $vids variable, which depends on "tm_integration" option enabled. Probably, we should:

  • rename variable to something like "term_path_api" and write update function
  • change it's title and description on settings form
  • make this option available even without Taxonomy Menu available
  • run hook only when option is enabled (and ask Taxonomy Menu for path if it is available)

This would be awesome to have it also working on views!
Greetings, Martijn

2 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.

Clarification 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 :)

Status:Needs work» Fixed

A bit different hook is now defined in TMT. See taxonomy_menu_trails.api.php.

Dev version will be packaged in the next 12 hours.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.