$nid variable available to php paths is not available when taxonomy_term_path is called from outside the taxonomy module.

The way it works means it is only available when called from taxonomy_link.

Comments

agileware’s picture

Status: Active » Fixed

I moved the code that gets the $nid variable out into it's own function.

The way it currently works works for standard drupal by checking for the node in the previous call to taxonomy_link.

I have added to that a check for the node in a previous hook_nodeapi function.
This means calls to taxonomy_term_path from a nodeapi function will get this $nid variable.
For example taxonomy_breadcrumb.

If there are other cases I think we will just have to add them as they pop up.
As it is now I think it covers most usage.

agileware’s picture

I have now added another case for when taxonomy_term_path is called from theme templates.

So if it is called from node.tpl.php or something like that the $nid variable will be there.

agileware’s picture

Title: $nid variable available to php paths is not always available » $nid variable available to php paths is not always available (is set to zero)

If anyone finds another case where the $nid variable is set to zero please reopen this case and give details.

Status: Fixed » Closed (fixed)

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