When you hit the title of a blog post the breadcrumbs are:
home>term>title

When instead you hit the 'comment' button, you go to what looks like the same page, with a totally different url
(/comment/reply/16#comment-form)
The breadcrumbs are:
home>title (>term is dropped)

I'm sure this has already come up under a different issue topic, but I don't really understand the intricacies of drupal enough to understand why this happens or where to post this behaviour.

Taxonomy breadcrumbs is also enabled but makes the same mistake.

Comments

MGN’s picture

Version: 6.x-1.4 » 6.x-2.x-dev
Category: bug » feature

The core comment module sets the breadcrumb on the reply pages. Since these reply pages are forms (associated with nodes, but not nodes), Custom breadcrumbs 6.x-1.x can't alter the breadcrumb defined by the comment module. Same goes for taxonomy_breadcrumb.

There is a way to accomplish this. Custom breadcrumbs could implement hook_form_alter and check to see if it is a comment (in reply to a node). If it is, then cb could load the node and run custom_breadcrumbs_nodeapi() to set a custom breadcrumb according to the type of the node associated with the comment.

I will see if I can implement this as a feature request in custom_breadcrumbs 6.x-2.x-dev.

MGN’s picture

Status: Active » Needs review
StatusFileSize
new796 bytes
<?php
/**
 * Implementation of hook_form_alter().
 */
function custom_breadcrumbs_form_alter(&$form, $form_state, $form_id) {
  // Provide custom breadcrumbs for comment forms associated with nodes.
  if ($form_id == 'comment_form' && isset($form['nid']['#value'])) {
    $node = node_load($form['nid']['#value']);
    // Call custom_breadcrumbs_nodeapi to provide a custom_breadcrumb for this comment.
    custom_breadcrumbs_nodeapi($node, 'alter', array(), array(1));
  }
}
?>

This seems to work in 6.x-2.x-dev. I haven't tested it in 6.x-1.x, but I think it should work there also. If you would like to try it out, you can place this function in custom_breadcrumbs.module, or apply this patch (to 6.x-2.x-dev).

MGN’s picture

StatusFileSize
new1.07 KB
puppetmast0r’s picture

Thanks, I'll give it a try :)

MGN’s picture

Status: Needs review » Fixed

Committed to 6.x-2.x for further testing.

Status: Fixed » Closed (fixed)

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