I'm not sure if this is a panels_everywhere issue or a panels issue or a context issue or something else entirely but the behavior is perplexing.

* panels_everywhere 6.x-1.1
* panels 6.x-3.9
* context 6.x-3.0

If I print the breadcrumb in the page.tpl.php, then it shows up as expected with the breadcrumb that has been determined by the context module. But, if instead, the breadcrumb is shown in a panel, it shows the breadcrumb that has been determined based on the menu router (I think).

I have attached a screenshot. The top breadcrumb is the one that has been put in the page.tpl.php. The breadcrumb instead the white box is the one that is in the panel.

CommentFileSizeAuthor
bp_breadcrumb_panels_weidness.png6.18 KBkristen pol

Comments

merlinofchaos’s picture

Hm. It's possible that context module acts later than when Panels renders the breadcrumb, so it gets the pre-context breadcrumb. I'm not actually sure how to address this.

kristen pol’s picture

I did go through and try different themes because I thought it might have something to do with the theme but all the themes I tried had the same problem.

Let me try toggling my module weights to see if I can get context to get hit earlier.

Kristen

merlinofchaos’s picture

I don't think module weights matter. I think it's about when during the page building process that context.module acts on the breadcrumb. If it's doing its magic during preprocess_page then Panels has already generated the breadcrumb and it's using whatever was already created.

kristen pol’s picture

Status: Active » Closed (fixed)

Module weights did not help but I figured out a workaround. I added the following code to the top of my panels-pane.tpl.php file:

if ($pane->type == 'page_breadcrumb') {
  if ($plugin = context_get_plugin('reaction', 'breadcrumb')) {
    $plugin->execute();
  }
  $content = theme('breadcrumb', drupal_get_breadcrumb());
}

Thanks for the insight that it was a timing issue... makes sense. I'm glad to finally have figured this one out because it was driving me crazy.

[update] Just reading your recent comment... I'm not really sure when the breadcrumb gets created. I saw that context has a few contexts built in hook_init so maybe it really should go there. I could try that.

Kristen

merlinofchaos’s picture

Ohh! THen a proper integration would look something like this:

function MODULENAME_panels_pane_content_alter(&$content, &$pane, $args, $context) {
  if ($pane->type == 'page_breadcrumb') {
    if ($plugin = context_get_plugin('reaction', 'breadcrumb')) {
      $plugin->execute();
    }
    $content = theme('breadcrumb', drupal_get_breadcrumb());
  }
}

That could be given to context.module or a context/panels integration module and make it work properly for everyone.

kristen pol’s picture

That works with one small change where:

$content = theme('breadcrumb', drupal_get_breadcrumb());

becomes:

$content->content = theme('breadcrumb', drupal_get_breadcrumb());

e.g.

function MODULENAME_panels_pane_content_alter(&$content, &$pane, $args, $context) {
  if ($pane->type == 'page_breadcrumb') {
    if ($plugin = context_get_plugin('reaction', 'breadcrumb')) {
      $plugin->execute();
    }
    $content->content = theme('breadcrumb', drupal_get_breadcrumb());
  }
}

Thanks!
Kristen

kristen pol’s picture

Title: Breadcrumb is different in page.tpl.php compared what is in panels-panel.tpl.php » Breadcrumb is different in page.tpl.php compared what is in panels-panel.tpl.php when using context breadcrumbs

Changing title to reflect the use of context since that is the key.