I have some node pages being rendered by Panels. I'd like a Custom Breadcrumb for the Panel to include some Tokens from the current node being viewed, and can't get it working yet.

Even showing something like this, [node:nid], doesn't seem to work. Maybe with Panels, these Tokens aren't available? I honestly don't know.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

minneapolisdan’s picture

Anybody done this before?

minneapolisdan’s picture

Does my question not make sense? Or this just an unpopular topic? :)

MGN’s picture

Status: Active » Postponed (maintainer needs more info)

This was working in 6.x-2.x. It sounds like custom breadcrumbs is not getting a node context from the panel. Have you assigned a context for the panel (one of the many panel configurations)?

MGN’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
2.23 KB

I've identified a number of changes in panels that might account for this. Can you try this patch and see if it fixes the problem?

pepejose’s picture

hi,

I applied this patch but nothing changes, still no token content.

I use panel page node with argument nid and respective context but then in custom breacrumbs, token values are empty.

thanks, sorry for my poor english.

EDIT: It works if taxonomy term reference fielf has only one value

ownage’s picture

I think I'm having the same problem using taxonomy with panels. I'm also using this dev.

It can't find the taxonomy term reference field used in one of the content panes in my panels variants.

Format example:
Cadet Store
[node:field-uc-product-type1]
[current-page:title]

URL: http://gmsaa.org/store/classic_flight_jacket
Taxonomy Term: [node:field-uc-product-type1] (this should output Apparel & Fabrics)

But instead outputs:
Home » Cadet Store » Classic Flight Jacket

It works in Views, so I don't know why it isn't working in Panels.

bjalford’s picture

Saw this: http://drupal.org/project/panels_breadcrumbs

not sure if it helps or not?!

minneapolisdan’s picture

I have been using the Panels Breadcrumbs modules now, and it seems to work well.

acidpotato’s picture

Version: 7.x-2.x-dev » 7.x-1.0-alpha1
Category: support » bug
Status: Needs review » Active

Facing the same problem, node tokens don't showup on Panel Node page. I tried with [node:nid] and many other node tokens but none of them appear on the Panel Node Page. Therefore changing the status of the issue. If this has been fixed in 7.x-2.x-dev please feel free to close this issue.

tanickl’s picture

Version: 7.x-1.0-alpha1 » 7.x-2.x-dev
Component: Code » custom_breadcrumbs_panels

#4: Thank you for the patch. It worked for my use case. I can now use node tokens on node pages being rendered using panels.

acidpotato’s picture

Hi tanickl, may I ask what Panels version you are using? I am using 7.x-3.2 and after applying patch to CB 7.x-2.x-dev I can't get node fields to appear as crumbs on Node Panel Page.. what secret sauce did you use?
In the admin/config/user-interface/custom-breadcrumbs do I have to select certain boxes? Also whats your hierarchy of CB weights? I have the Panels the heaviest weight still no dice.

morbiD’s picture

The posts above are unclear as to whether they are trying to use custom breadcrumbs on Panel Nodes or Node Templates, the difference being that a Panel Node is a specific Panel with a path, while a Node Template is a Panel that overrides the display of all nodes that match the selection criteria.

The patch doesn't seem to make tokens work for Node Templates. I assume tanickl is using Panel Nodes.

I did a bit of poking around in the code and as far as I can tell, the if ($page) { ... } block in custom_breadcrumbs_panels_ctools_render_alter() returns out of the function before it ever gets to the block dealing with Node Templates, so the node context is never passed on.

Adding the following lines after $objs = array('panel' => $info); seems to pass on the node context and make the tokens work:

        foreach ($contexts as $context) {
          if (is_array($context->type) && (in_array('node', $context->type) || in_array('entity:node', $context->type)) && isset($context->data)) {
            $objs['node'] = $context->data;
          }
        }

I guess the function needs a bit of a rewrite though, since the Node Template code is apparently never evaluated.

elyobo’s picture

-morbiD-'s changes work fine for me.

elyobo’s picture

Unfortunately upgrading to the dev version breaks all the normal breadcrumbs (drupal error, no idea what due to https://bugs.php.net/bug.php?id=61045)...

elyobo’s picture

Fixed other issues; everything working fine for me at the moment. The dev version is well ahead of the stable, is there any time frame for the next release?

tripper54’s picture

Status: Active » Needs review
FileSize
2.43 KB

morbiD's changes in #12 worked for me, thanks.

Here's a patch incorporating #4 and #12

Nikro’s picture

Status: Needs review » Reviewed & tested by the community

#16 tripper54 patch seems to be good.

I'm just not sure of loading all the nodes from all the panes is the thing we want to use (patch #4).

It would be nice if panels would offer more token support, I would put it here but it's definitely related to the panels module.
Would be nice to use any context from within the panel.

colan’s picture

Status: Reviewed & tested by the community » Fixed

Committed in 1783356.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

clarifying