Request that taxonomy_breadcrumb work with Panels. I have several web pages where I use the Panels module. As far as I see taxonomy_breadcrumb does not work with a Panels page.

Comments

_craig’s picture

Status: Active » Closed (fixed)

To make a long story short, there's no nice way to modify taxonomy_breadcrumb to work with the panels module. Here's why:

taxonomy_breadcrumb creates it's breadcrumbs for when node are displayed as pages (i.e. when you visit node/123 or a path alias equivalent). While the panels module can make use of nodes, it doesn't actually display the node as pages (at node/123). Instead it acts as a container type for zero or more nodes. Therefore, there’s no way for the taxonomy_breadcrumb module to change the breadcrumbs on a panel page.

That being said, I did make a fix to the CVS HEAD version of taxonomy_breadcrumb.module that gets you half-way to solving this problem (currently CVS HEAD works with drupal 4.7.x, get it here: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/taxonomy_brea... ). There is a function called taxonomy_breadcrumb_generate_breadcrumb($nid) that can be called from anywhere to modify the breadcrumb trail according to the node ID ($nid). A hack to node.inc in the Panel module would be the other half of the fix:

function panels_content_node($conf) {
$node = node_load($conf['nid']);
taxonomy_breadcrumb_generate_breadcrumb($conf['nid']); // Add this line
$output = node_view($node, $conf['teaser'], FALSE, $conf['links']);
return $output;
}

Now, this is just an example hack, you may want to actually check to see if taxonomy_breadcrumb is enabled and/or the function exists before you call it. There may also be a way to do this from the theme, but I’m not sure...

Also, keep in mind you can have more than one node displayed on a panel page. What if they have different taxonomy terms and thus different breadcrumb trails? Which one do you want to show? The hack to node.inc above will just show the breadcrumbs for whatever node is last, which may or may not be good enough.

summit’s picture

Title: taxonomy_breadcrumb working with a Panels module page » drupal 5, taxonomy_breadcrumb working with a Panels module page
Status: Closed (fixed) » Active

Hi,

Is this hack also available for taxonomy_breadcrumb and panels for Drupal 5?
If not, could you please file a patch?

Thanks in advance,
greetings,
Martijn

summit’s picture

Title: drupal 5, taxonomy_breadcrumb working with a Panels module page » drupal 5 question update: taxonomy_breadcrumb working with a Panels module page

I didn't want to change the title at first, so I changed it to be in sync with the question.

greetings,
Martijn

_craig’s picture

Status: Active » Closed (fixed)

I haven't looked at the Panels module code recently, but I imagine a similar code change could still be made for 5.x (the Panels function may or may not have changed since 4.7).

  1. You'll have to find the right Panels function to use and
  2. get the term-id of the node so you can pass it to taxonomy_breadcrumb_generate_breadcrumb. In 4.7 taxonomy_breadcrumb_generate_breadcrumb took a node-id, now it takes a term-id.

Let me also point you to this issue, which is similar, but for a different module.