Per http://groups.drupal.org/node/47904

I am building a website in ProsePoint for a small daily newspaper. The stories will likely be linked to more than one taxonomy term, but I would like to be able to use breadcrumbs to point users back along the path of one term for each story.

If I use Taxonomy Breadcrumb by itself, it doesn't always choose the term that I would like. I can use Primary Term and Custom Breadcrumb to set up a breadcrumb trail with just one term (the Primary Term), but I want the entire breadcrumb trail, the way it's displayed in Taxonomy Breadcrumb.

Can anyone help me to combine (somehow) the functionality of Primary Term and Taxonomy Breadcrumb to get the result I want?

Funny enough I need the exact same thing, and so I'm going to add it. Mostly TB code, cloned into PT, with options to generate the breadcrumbs as desired.

Comments

sethcohn’s picture

Looking over the best way to do this, it looks like adding a nodeapi hook that runs after taxonomy_breadcrumb, which replaces the breadcrumb built by TB, with one with the PT term, is the best and cleanest answer here.
Very little code to clone. Check to see if TB is enabled, and if so, fire off a new _taxonomy_breadcrumb_generate_breadcrumb with the primary term for the right breadcrumb(s).

Since I'm already going to adjust the weighting of PT for other reasons (taxonomy i18n), easy enough to just ensure we run after TB as well, at the same time.

greggmarshall’s picture

While I was looking for how this could be done, I came up with a quick and dirty solution by modifying Taxonomy Breadcrumb based on a comment in http://groups.drupal.org/node/47904

In taxonomy_breadcrumb.inc file at line 47, right after the definition of the function _taxonomy_breadcrumb_node_get_lightest_term, I added this bit of code:

  // Return the Primary Term module's primary term instead of the lightest term.
  if (module_exists('primary_term')) {
    return taxonomy_get_term(primary_term_get_term($node->vid));
  }
  // Original Taxonomy Breadcrumb code in case the Primary Term module isn't enabled.