The taxonomy module supports the creation of alternative term creation through hook_term_path, but it is not documented in the APIs. While we're at it, something about how one might update the module field in the vocabulary to allow this feature would be nice too. Creating the links with this feature would seem more intuitive to module designers that the use of hook_link_alter after the fact.

CommentFileSizeAuthor
#7 141965-taxonomy_term_path.diff675 bytesjeffschuler
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

How did you find this out then? I cannot find it in taxonomy.module.

NancyDru’s picture

It's in the function taxonomy_term_path:

if ($vocabulary->module != 'taxonomy' && $path = module_invoke($vocabulary->module, 'term_path', $term))

I had seen it awhile ago, as well as the field in the database, but didn't pay it much attention until I saw it in a forum post the other day. It was one of those "Duh!" moments.

NancyDru’s picture

Version: 5.1 » 6.x-dev
NancyDru’s picture

Version: 6.x-dev » 7.x-dev
webchick’s picture

Project: Drupal core » Documentation
Version: 7.x-dev »
Component: taxonomy.module » Documentation in CVS

Moving to docs queue.

betz’s picture

Project: Documentation » Drupal core
Version: » 7.x-dev
Component: Documentation in CVS » documentation

Changed the component to reflect the new component categorization. See http://drupal.org/node/301443

jeffschuler’s picture

Status: Active » Needs review
FileSize
675 bytes

taxonomy_term_path() is documented in code, but the comment is displaced from the function by 1 line of whitespace -- I assume this is why it's not being pulled into the API docs.

This patch just removes the line of whitespace.

Should hook_term_path() be added to taxonomy.api.php? ...and possibly be called hook_taxonomy_term_path() for consistency?

NancyDru’s picture

I don't think the name should be changed as this hook can generate paths for any module, not just Taxonomy.

moshe weitzman’s picture

Long term, I'd like to see us commit #320331: Turn custom_url_rewrite_inbound and custom_url_rewrite_outbound into hooks and then remove this special case hook entirely.

NancyDru’s picture

This hook is used in a lot of places, so make sure the upgrade path is clearly documented.

Status: Needs review » Needs work

The last submitted patch failed testing.

webchick’s picture

Status: Needs work » Needs review

I think testing bot is lying. Marking back to needs review and requesting a re-test.

catch’s picture

Status: Needs review » Reviewed & tested by the community

test bot's happy.

webchick’s picture

Version: 7.x-dev » 6.x-dev

Committed, thanks! Looks like it needs committing to 6.x and 5.x as well.

Gábor Hojtsy’s picture

Version: 6.x-dev » 5.x-dev

Committed to Drupal 6. Needs commit to Drupal 5.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Missed this since it was marked as a feature. Committed to 5.x.

NancyDru’s picture

Status: Fixed » Closed (fixed)

Thanks