I am trying to implement a block that displays the highest priority cases from casetracker. The problem is that it overwrites the breadcrumb on every page it displays on. The breadcrumb is always the same and references the last enry in the block. I have tested it by changing the number of items in the block, and each time it is the breadcrumb that should be displayed when the last entry in the block is displayed in full.

I have attached the view export.

Comments

merlinofchaos’s picture

Project: Views (for Drupal 7) » Case Tracker

This is most likely casetracker setting the breadcrumb.

ambereyes’s picture

Status: Active » Needs review
StatusFileSize
new1.29 KB

I think I found the problem. My first patch!

The problem is twofold:

  1. casetracker_nodeapi sets the $teaser and $page to null.
    function casetracker_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) 
    

    So I removed the nulls.

    function casetracker_nodeapi(&$node, $op, $teaser, $page )
    
  2. then it fails to test to see if the view op is being called for a full page view before setting the breadcrumb for case listings.
          // cases: summary data to beginning of body.
          if (in_array($node->type, variable_get('casetracker_case_node_types', array('casetracker_case')), TRUE)) {
            $project = node_load($node->pid); // used in the breadcrumb and our theme function, mostly for nid and project number display.
            drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('case tracker projects'), 'casetracker/projects'), l($project->title, 'node/'.$node->pid), l(t('all cases'), 'casetracker/cases/'.$node->pid.'/all')));
            $node->body = theme('casetracker_case_summary', $node, $project);
          }
    

    So I added a test for $page.

          // cases: summary data to beginning of body.
          if (in_array($node->type, variable_get('casetracker_case_node_types', array('casetracker_case')), TRUE)) {
            $project = node_load($node->pid); // used in the breadcrumb and our theme function, mostly for nid and project number display.
            if ($page) {
            	drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('case tracker projects'), 'casetracker/projects'), l($project->title, 'node/'.$node->pid), l(t('all cases'), 'casetracker/cases/'.$node->pid.'/all')));
            	}
            $node->body = theme('casetracker_case_summary', $node, $project);
          }
    

I made the changes and it fixed the problem.

morbus iff’s picture

Duplicate of http://drupal.org/node/107178. Fixed in the latest 5.x version.

morbus iff’s picture

Status: Needs review » Closed (duplicate)

ambereyes: incidentally, your first patch is absolutely correct, and is just the way I fixed it in 5.x too. Excelsior! :)