I'm creating a blog as part of my site. It's not on the front page. All "articles" are in a page of a View created via the Views module, which can be thought of as the home page of the blog.

I created a breadcrumb for just the blog home page, using "breadcrumbs for Views", and that appeared correctly on just the one page.

But then, as soon as I created a breadcrumb to use for the individual article pages, that second breadcrumb appeared on the /blog page too, seemingly overriding the View one. I tried it with both "node" breadcrumbs for just Article node types, and "path" breadcrumbs for just /blog/* - same result each time.

a) That doesn't actually seem right to me, because I would have expected a page created by the Views module not to be an "Article" - is it? though it does contain some.

b) and should "blog/*" include "blog"? It would perhaps be more convenient if it didn't. ("blog" could still be added as a separate path.)

c) Regardless of (a) and (b), I could fix my problem if I knew a PHP snippet to single out just the Views page.

I think that page isn't a node... it contains nodes, but I don't think it is one, if I've understood correctly. So in that case it wouldn't have a "nid". Or if it does, I'm not sure how to find it.

Is there a way for the PHP to identify a page as having been created by Views?

Is there a way for the PHP to see the page's URL?

(Or presumably I could fix it by "weighting" breadcrumbs if that feature request had come into being. But as far as I understand, that hasn't been implemented yet. Or if it has please tell me :-) )

In case it makes any odds, this is with the current version of 7.x-2.x-dev, from 2011-Jul-21.

Thanks in advance for all clues!

CommentFileSizeAuthor
#7 breadcrumbs.jpg879.13 KBselinav
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MGN’s picture

Status: Active » Postponed (maintainer needs more info)

You are thinking about this correctly. The views breadcrumb should be selected when at the views page.

I tried but haven't been able to reproduce the problem yet.

What options have you enabled on the custom breadcrumbs configuration (settings) page?

What is the relative weighting of the custom breadcrumbs and custom breadcrumbs views module - you can adjust this on the configuration page. By default custom breadcrumbs views should have a heavier weight (lower on the list) than custom breadcrumbs.

Jennifer_M’s picture

Title: Articles want one breadcrumb, "View" of all articles wants another, "View" one seems to be overridden » Breadcrumb assigned only to Article nodes but showing (unwanted) on page made by Views module
Status: Postponed (maintainer needs more info) » Active

The configuration page still has its "out of the box" defaults - I haven't changed it. (Won't list those unless you ask me to, as I'm guessing you know what the defaults are :-) )

Thanks for the info about the module weights. I had heard of the concept before, but it hadn't dawned on me how it could be used in this context. Interesting!

However, I'm experimenting with a different simpler thing now, as reflected in amended issue title: breadcrumbs on the Article pages, and aiming (unsuccessfully) at no breadcrumb at all on the Views page which collates them. (The View is "all published articles in reverse order of date".) I actually did this as a design experiment rather than a troubleshooting experiment, and I think now it's probably the design I'll go with.

So now the module weights aren't a factor. The new question is simply why a Nodes-type breadcrumb assigned only to Article nodes is appearing on the Views-created page at "/blog". I'm guessing that isn't intended behaviour... though it's not my place to say what behaviour is intended :-)

Can you replicate that part? Or do you think it's something odd at this end?

It occurs to me that $node->type == 'article' for the nodes on the Views page, and presumably the $node variable is set a few times in rendering the page. Could that be what C.B. is detecting?

I should also mention that today I've had no success setting these breadcrumbs with the equivalent Paths method, whereas that was partly-working OK yesterday according to what I wrote then (probably true, but didn't double-check then so slightly unsure now). Today, anything with a wildcard asterisk in the path just didn't appear. Non-wildcard ones showed up in the right places. Tried rebooting the system, made no difference. Doesn't matter to me in itself right now, but included here for completeness in case it's a clue.

Jennifer_M’s picture

Some more experiments and info...

a) I only just realised there's a checkbox to enable wildcards, which was unset, so that's presumably why those weren't working yesterday. (though I'm now perplexed how they managed to be working the day before, if indeed they were... maybe I'd accidentally clicked to unset when I went to look at the settings page(?))

b) Also discovered the "Excluded paths" option. Trying that with just the path "blog" works very nicely to make the Articles breadcrumb disappear from the blog page, but it also gives me an error message:

* Notice: Undefined index: q in custom_breadcrumbs_exclude_path() (line 1194 of {directory system omitted}/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs.module).

c) Just by way of experimental poking-around, since you'd gone to the trouble of suggesting it, I did experiment with the module weights. I switched off "Excluded paths" again and made a test bookmark for "blog" using Views (as I'd deleted the one from earlier), then gave the Views module a higher weight. But it's still showing the Articles breadcrumb despite the supposedly higher weight of the Views one.

That checkbox for "Adjust module weights" - is that only meant to be checked while you're actually changing them, or is it meant to stay checked to mean "Use these changed weights"? In fact it's unchecking itself on "save", but if it only means "Let me change the weights" then presumably that's correct.

(If it is just to give permission for the change, then from a user-friendliness point of view I don't really like that - it took me a while to realise the checkbox was there, because it doesn't match other bits of Drupal interface. In e.g. Blocks or Menus, you can just move the weights and then save. I was doing that and then wondering why it hadn't "stuck", and only then noticed the checkbox.)

Hope all this is useful in some way :-)

Jennifer_M’s picture

More experimentation. I can make it go the way I want using "Breadcrumb visibility" field in the "node type articles" breadcrumb:

$view = views_get_page_view();
if (empty($view)) 
{
  return TRUE;
}
else 
{
  return FALSE;
}

(see http://drupal.org/node/1244696)

That's successfully not showing the breadcrumb on the /blog page which is generated by Views.

Won't take it upon myself to set the issue to fixed, as there are still aspects of CB's behaviour which aren't what I'd expect. I think this bit of code probably counts as a workaround rather than a fix. But it's OK for my purposes.

MGN’s picture

Wow. Looks like this issue has blossomed into several.
* Fixed the undefined index notice you were getting with the exclude paths option
* Removed that pesky checkbox

These have been fixed in commit 491ce37 on 7.x-2.x

Otherwise, I still haven't been able to reproduce the problem. Your workaround makes sense and is a good use of the breadcrumb visibility option when custom breadcrumbs for nodes is interfering with custom breadcrumbs for views. I just haven't been able to create a view that somehow invokes hook_node_view (needed to fire custom breadcrumbs for nodes). I am starting to wonder if its something specific to the view or something else on the page that might be rendering the node... Still, despite the fact that I can't understand why its needed, your workaround is a good fix.

MGN’s picture

Status: Active » Postponed (maintainer needs more info)

marking as postponed for now - though I am not sure exactly what additional information I need to help with this. Perhaps additional information regarding the view (see above).

selinav’s picture

FileSize
879.13 KB

Hello,

I use the 7.x-2.0-alpha3 version and I have similar problem.
I have a content type "actualite" and I have a breadcrumb for this node type and one for a view displaying the nodes of this content type.
On the view page, the breadcrumb of the node is displayed instead of the breadcrumb for the view. (see attached image).

More over, I have also error messages on the page "admin/structure/custom_breadcrumbs"

Notice : Undefined offset: 0 dans custom_breadcrumbs_page() (ligne 41 dans ...\sites\all\modules\custom_breadcrumbs\custom_breadcrumbs.admin.inc).
Notice : Undefined offset: 1 dans custom_breadcrumbs_page() (ligne 41 dans ...\sites\all\modules\custom_breadcrumbs\custom_breadcrumbs.admin.inc).
Notice : Undefined offset: 2 dans custom_breadcrumbs_page() (ligne 41 dans ...\sites\all\modules\custom_breadcrumbs\custom_breadcrumbs.admin.inc).
Notice : Undefined offset: 3 dans custom_breadcrumbs_page() (ligne 41 dans ...\sites\all\modules\custom_breadcrumbs\custom_breadcrumbs.admin.inc).
Notice : Undefined offset: 4 dans custom_breadcrumbs_page() (ligne 41 dans ....\sites\all\modules\custom_breadcrumbs\custom_breadcrumbs.admin.inc).

The #4 solution doesn't work for me.

What can I do ?

fragtom’s picture

After installing on current drupal 7.x / views installation, the same behavior occurs with views and contextual filters. That means, the breadcrumbs would be fine for the case, all contextual filters are set. But display without parameters shows all breadcrumbs..