One way to get a view is to edit as normal. The view is then in the database. When transferring to a live site it is possible to export the view and put in it a sitemodule.views_default.inc file. That makes it a hard coded view like the ones that come with views. I believe this is also faster. It's certainly simpler in some respects.

Custom breadcrumbs views drop down only lists the normal views not the views_default.inc ones. Doing an edit and save of a views_default.inc view makes the view visible as it puts a copy in the database (I assume) so that is a workaround for now.

Is this a real bug or this a valid reason why custom breadcrumbs have to use a soft view?

CommentFileSizeAuthor
#4 disabled_views_bug.diff876 bytesMGN
#3 disabled_views_bug.diff847 bytesMGN

Comments

MGN’s picture

Category: bug » support

Thanks for the report. Custom breadcrumbs views uses the views api function views_get_all_views() to get the list of views. It then filters this list to remove any disabled views and views that don't have a page display.

Apparently this is not sufficient to pick up on the hard coded views?

I thought views_get_all_views would do as the name suggests. Anyway, if anyone knows of another approach (via the views api) please let me know.

At this point its probably an omission since I haven't used hard coded views and no one else has mentioned a problem. Before we consider this a bug, we need to determine what is actually wrong with the current approach.

malc_b’s picture

I can confirm that views_get_all_views() doesn't return the hard coded ones. Perhaps this is really a views error? I guess the other way around is to use the custom breadcrumb by path.

What I'm trying to do is make the breadcrumbs consistent. What I currently get is:

Any page not in menu heirarchy (i.e. level1 or not in menu), BCrumb = Home
Any page in menu at level2, BCrumb = Home :: MenuLevel1

So reasonably sensible

A 1 level view to select taxonomy terms with pager, BCrumb = Home :: ViewTitle
Taxonomy term page, BCrumb = Home
A 2 level view (e.g. country, state) to select taxonomy terms with pager, 1st level BCrumb = Home
2nd level BCrumb = Home :: ViewTitle
Taxonomy term page, BCrumb = Home

This is wrong, the taxonomy page needs fixing to give a breadcrumb back to view and the single level view needs to lose the breadcrumb. Or I suppose every page could end with a self-reference on the breadcrumb to be consistent with the view. I can't find a way that works to remove the 1 level view breadcrumb so perhaps adding self-reference is the only workable option. I don't understand what gives that breadcrumb as it isn't a menu item doing it.

MGN’s picture

Assigned: Unassigned » MGN
Category: support » bug
Status: Active » Needs review
StatusFileSize
new847 bytes

You were right. Its a bug. And of course I do use hard coded views, I just hadn't heard the term before. See the attached patch. I think it should fix the problem.

MGN’s picture

StatusFileSize
new876 bytes

Ooops. Wrong patch. Try this one instead.

malc_b’s picture

The patch works (for me). All my hard code views (do they have another name?, I just made that up) now appear on the custom breadcrumb set up form.

BTW there is another problem in that there aren't any views tokens, AFAIK, to make a useful custom breadcrumb. Say I decide to have my breadcrumbs as

Home :: Menu level 1 :: Title

That is to add the current page title, or for view the taxonomy term to the end of breadcrumb as either a link or plain text. For example take a country/state view. The top level title would be "Browse by country" and the url browse_by_country. If I then select usa then the url becomes browse_by_country/usa and the title becomes "Browse by country : USA". In that case I'd want a breadcrumb of

Home :: Browse by country :: USA

But how to get the USA as a token? It doesn't seem to be one AFAIK. BTW setting up the rest is not difficult. I just create 2 custom breadcrumbs for this single view and set the visibility based on the arg string. If arg(1) is true then the url browse_by_country/something

MGN’s picture

Status: Needs review » Reviewed & tested by the community

If your view returns nodes, then the node tokens should work. Also, the global and user tokens always work. For views with taxonomy arguments, the taxonomy tokens will also work.

In your example, if USA is the top level term, then [term] (and related) will work. If your view takes taxonomy arguments then [cat] (and related) would work.

Other than that, you may need to develop your own tokens.

Thanks for testing. I hope this helps!

MGN’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 6.x-2.x-dev.

malc_b’s picture

Thanks for the suggestions but neither [term] nor [cat] work. The way the view works is if there is no argument then all top level country terms are displayed. If there is an argument then only the sub terms below that are displayed. So on the second level you are still within the view, which now displays a list of terms. When you click one of those you go to the taxonomy page for that. So the way it works is:

Displays list of countries, Pick a country
Display list of states in that country, pick a state
Display nodes with that taxonomy term (the state), pick a node
Display node

The problem now is when I get to taxonomy page the breadcrumb should really be parent_term, term.

But I have found were views breadcrumb comes from. My views argument is taxonomy term and editing shows a breadcrumb override box and the info that if not overridden then the title is used.

malc_b’s picture

I had to add a custom token, return parent of term, in order to get the breadcrumb I wanted.

Status: Fixed » Closed (fixed)

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