I've got a Panel page for my search results and a custom breadcrumbs set up to simply set the breadcrumbs to:

Titles:
Search Results

Paths:
search/results

If I debug through the code in the custom_breadcrumbs_panels module I can see the breadcrumb being set correctly and the Home crumb being added on, but it's not showing in the breadcrumb panels pane. If I debug with a theme_breadcrumb(&$vars) hook I'm not getting the custom breadcrumb at all. I need this breadcrumb to work as Panels doesn't set the page title correctly so my breadcrumbs are broken without this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MGN’s picture

Category: bug » support

Sorry, I haven't been able to reproduce this. Have you tried clearing the cache? Is there any breadcrumb at all shown for the page? If so, what is it? Check the weight of the custom breadcrumbs panel module on the settings page and see if there is another custom breadcrumb module that might be overriding the output. If there is a possibility for this, push custom breadcrumbs panels lower down in the list and save, clear the cache and see if there is a difference.

Marking as support request for now

acbramley’s picture

Yes, it's definitely not being cached. The breadcrumbs I'm getting are Home, then a link to the search results with no text (i.e drupal_get_title obviously didn't return the title of the page fast enough) then the search term I've entered so it's like:

Home > > ipsum

I've tried adjusting weights of custom breadcrumbs and all but with no help. I've even debugged into drupal_set_breadcrumb and found that correct breadcrumbs are returned at some point but much earlier than these incorrect ones are.

MGN’s picture

Priority: Major » Normal

Ok. I've been able to reproduce this now. The problem, as far as I've been able to figure it out, is that the breadcrumb data for panels pane is assigned before custom breadcrumbs has a chance to act. So the breadcrumb variable contains only Home. Later on, after the panel is assembled (with Home for the breadcrumb pane), custom breadcrumbs is able to set the breadcrumb for the page. So the page breadcrumb doesn't agree with the panels breadcrumb pane.

I haven't been able to dream up a fix for this yet. I can insert breadcrumb data into the pane using the hook_panels_pane_content_alter. But at the time when this hook is called, I don't have the data to insert. One approach to fixing this would be to try to figure out what breadcrumb custom breadcrumbs will assign (by calling custom breadcrumb hooks ahead of time) but this doesn't seem like it will necessarily get the correct breadcrumb and may, in fact, lead to the wrong breadcrumb for the page. A better approach would be to alter the panel, after the correct page breadcrumb has been assigned. But I haven't found a hook to do that yet...

I'll keep looking and try to fix this if I can. but this isn't really a bug in custom breadcrumbs - the page breadcrumb (afaik) is being set correctly. And panels is in charge of selecting the data for the breadcrumb pane in any way it wants to - I can't really affect that.

acbramley’s picture

Ok, thanks for the help anyway :)

tomogden’s picture

I'm getting this problem in all my panel pages as well, and custom breadcrumbs is working for normal pages.

I agree that logically Panels should execute later in sequence than pretty much anything in the theme layer. We should register an issue with Panels and pursue it there.

tomogden’s picture

I have submitted an issue in Panels: http://drupal.org/node/1377822 .

Letharion’s picture

Project: Custom Breadcrumbs » Panels
Version: 7.x-2.x-dev » 7.x-3.x-dev
Component: custom_breadcrumbs_panels » Code
Assigned: Unassigned » merlinofchaos
Category: support » feature

This seems like a reasonable feature request against Panels. I'm moving it over, making it a feature request, and we'll see. I can't say how much work is necessary to get this working properly, so it could get stuck in the issue queue for quite a while.

I'm wondering though, if maybe instead, a "Ctools breadcrumb" module would be the way to go here. Creating a ctools content type that can use the available context could perhaps solve this nicely.

@merlin Assigning to you so we can get an opinion about the way forward.

merlinofchaos’s picture

At what point does custom breadcrumbs actually have the data it needs?

tomogden’s picture

From what I can see, this module is depending on a hook_node_view function to identify the node type and load the custom breadcrumbs. But in Panels it never fires, so there is no identification of the node type, much less opportunity to load breadcrumbs.

merlinofchaos’s picture

aHA! Another incarnation of that problem! where _view hooks aren't happening because we don't have a way to perform a view process.

If that's the case, this can be worked around by performing a node_view in a hook, probably hook_panels_pre_render($display, $renderer)

This is not an ideal workaround, and not what I would consider the proper solution. However, the proper solution is still a little ways away and I need to spend some time making it happen.

tomogden’s picture

Not that I comprehend what you just said (sounds compelling, though), but I'm glad to help if you need an assistant.

Letharion’s picture

The source of the problem, node_view not always running, causes some other issues. You can read some more about that here #1118894: How to implement modules that use hook_nodeapi('view') in Panel Pages for nodes. I have also posted an example of the non-ideal workaround merlin mentions.

Letharion’s picture

Assigned: merlinofchaos » Unassigned

Un-assigning as merlin has commented :)

tomogden’s picture

Assigned: Unassigned » tomogden
Status: Active » Needs work

You guys are quite the team!

Okay, it sounds like I need to put this hook into a custom module until the day Merlin can implement the "proper solution". I'll report my results and any further needs back to this issue.

tomogden’s picture

Status: Needs work » Needs review
FileSize
872 bytes

Got it working in short order. Fairly minor function overall, so not much to go wrong.

See patch attached. I set it up to place into bread_crumbs Dev version 7.x-1.x, but it could go into any module other than Panels.

Thanks to @merlinofchaos for that handy pre_render function!

Letharion’s picture

Project: Panels » Custom Breadcrumbs
Version: 7.x-3.x-dev » 7.x-2.x-dev
Component: Code » custom_breadcrumbs_panels

In that case I guess we send it back.

merlinofchaos’s picture

You'll want to check and make sure that the context actually exists before you try to use it; that could be any display.

tomogden’s picture

The corrected patch attached should take care of contexts, such as with the home page, where no node is present.

MiSc’s picture

Tried to make this work in D6, with the following code:

function custom_breadcrumbs_panels_pre_render($display, $renderer) {
  $node = $display->context['argument_nid_1']->data;
  $result = node_build_content($node, 'full');
  return NULL;
}

I get to node-object and I could render it, but still custom breadcrumbs does not work for me. What am I missing?

Which function could I call t do something similar that custom_breadcrumbs_node_view does in the D7 version?

mcjim’s picture

Amended patch to apply to current dev release (no code changed).

MiSc’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev

Does anybody have an working solution for d 6?

tomogden’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

Doh! Don't hijack this issue, just as we're waiting for approval. Please start your own issue for D6.

MiSc’s picture

I'm not hijacking, just asking if somebody has the _same_ issue in 6. It is related.

bsandor’s picture

HI Guys,

I am also interrested in D6 version. Is there any?

Thanks.

tomogden’s picture

Proper procedure is that you:

  1. Search the Issue Queue for that code base, D6 in your case.
  2. If you don't see an issue, then you can create one.
  3. If a duplicate issue exists, someone will usually notify you, point you to it and close the later duplicate.

You can do a proper search on the "Advanced Search" form. See http://drupal.org/project/issues/search/custom_breadcrumbs , and be sure to specify "6.x Issues".

MiSc’s picture

There are nothing like a "Proper procedure" on drupal.org, it is up to maintainers and users to communicate in the best way they can. If we try to be nice to each other an help out instead of the opposite, we have a even better community, and in the end, a better product.

It would be pretty easy to specify if there are a solution for this or not, and provide a link if there is.
And why do you think that we have not searched for the solution? I have not found any that are working with D6.

tomogden’s picture

Sorry, @MiSc. The D6 projects for Panels and Custom Breadcrumbs seem similar. I wish I know how to help.

HansKuiters’s picture

Patch from #20 works for me. Thanks for porsting.

Another thing to know to implement it: you need to create a node breadcrumb instead of a panel breadcrumb.

tomogden’s picture

Status: Needs review » Reviewed & tested by the community
liquidcms’s picture

Status: Reviewed & tested by the community » Needs work

seems to similar to not continue here.

i had the issue here that panels bcrumb pane was not affected by CB module. the patch in #20 fixed this for node overrides.

actually i had been trying to use panel bcrumb definition (which doesn't have node context); but after that patch my node tpl override was now picking up the std node CB definition; which i think is how it should be and pretty sure that's how this worked in D6. .. so all is good.. :)

but now i have same issue with forum (actually i think it is Advanced Forum which provides pre-canned panels pages for forum layouts). same issue as for nodes, if i add the Page element pane for Breadcrumbs i get a bcrumb trail unaffected by CB: http://screencast.com/t/tSsJfRvWeNcQ

the top is the std drupal trail that theme puts in and is the one defined by CB, the bottom one is the Panels one.

mrfelton’s picture

Status: Needs work » Needs review
FileSize
598 bytes
1.49 KB

Patch in #20 didn't work for me - neither on panel pages, or panelized node variants. I'm not using panel nodes, so it may well work for those.

But what did work for me is the combination of these 2 patches. One against custom_breadcrumbs, and the other against ctools. I don't quite understand why theme('breadcrumb' doesn't work, but theme_breadcrumb( does. With these 2 patches, I get breadcrumbs on Standard nodes, Panel pages, and panelized nodes.

EDIT: I should note that I'm abe to show the breadcrumbs with both delta_blocks' breadcrumb block, and with the ctools breadcrumb panel pane.

tomogden’s picture

Assigned: tomogden » Unassigned

This may need an update, as there have been changes in ctools since then.

Proteo’s picture

Issue summary: View changes

I had to solve this issue today, since I'm building a site that uses Panels pages to display both nodes and taxonomy terms. Patch from #20 works wonders for node pages, but I couldn't find any solution for taxonomy term pages. Digging into Custom Breadcrumb Panels module code, I came up with this which works great:

function CUSTOM_panels_pre_render($display, $renderer) {
  if (!empty($display->context['argument_entity_id:node_1']->data)) {
    // Node page
    $node = $display->context['argument_entity_id:node_1']->data;
    $result = custom_breadcrumbs_node_view($node, 'full');
  } elseif (!empty($display->context['argument_term_1']->data)) {
    // Taxonomy term page
    module_load_include('inc', 'custom_breadcrumbs_taxonomy');
    $term = $display->context['argument_term_1']->data;
    $result = _custom_breadcrumbs_taxonomy_set_breadcrumb($term->tid, $term->vid, TRUE);
  }
  return NULL;
}