Hey

I'm working on a site at the moment where I am using custom breadcrumbs. I got a request where the client requested the 'Home' in front of the breadcrumb trail not to show when on a specific page (just the sub in the trail)

I know this kind of defies the logic of a breadcrumb but what the client want we give right?

So I was looking at the code in the module, and see that the Home in front of the trail is generated by $trail = array(l(t('Home'), '<front>'));. Does anyone have a suggestion on how to make this code detect several pages and spit out a different start trail for specific pages? I've got 3 pages which matches this case... So for example, I've got a page called 'Recent Work' where the trail should start with 'Recent Work' and have subs 'Recent Work #1' & #2

Thanks!

Comments

MGN’s picture

Version: 6.x-1.4 » 6.x-2.x-dev
Category: task » feature

What is the logic that you want to code to detect the pages? Is there a taxonomy structure at work here, where Recent Work #1 and Recent Work #2 are taxonomy child terms of Recent work? If so then the taxonomy_breadcrumb module could handle this case. Otherwise...

The option to customize the Home breadcrumb text has just been added to 6.x.2.x-dev. This is still under active development, and needs to be tested on a non-production site if you are interested in trying out the new code.

In the latest version, there is a global configuration (at admin/settings/custom-breadcrumbs) to change (or omit) the home text on custom breadcrumbs pages. To get the behavior you are looking for, you can choose to omit the 'Home' breadcrumb by default and then add it back on the pages you want it by explicitly listing 'Home' and <front> for the first title and path of the custom breadcrumbs.

MGN’s picture

Status: Active » Fixed

Marking this fixed because it should be possible to do this in 6.x.2.x-dev now. Reopen as necessary.

Status: Fixed » Closed (fixed)

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

vthirteen’s picture

Category: feature » support
Status: Closed (fixed) » Active

In the latest version, there is a global configuration (at admin/settings/custom-breadcrumbs) to change (or omit) the home text on custom breadcrumbs pages. To get the behavior you are looking for, you can choose to omit the 'Home' breadcrumb by default and then add it back on the pages you want it by explicitly listing 'Home' and for the first title and path of the custom breadcrumbs.

that's what i did: no 'Home' breadcrumb by default and a custom breadcrumb for specific content type, which includes Home crumb.

instead, the Home breadcrumb link keeps appearing on all pages (except front page itself), including Contact page, views pages, etc. (i deleted the cache data but it didn't help.)

[edit]: i just tested with garland theme and the output is exactly the same as with my custom theme.

vthirteen’s picture

to have custom bradcrumbs on chosen pages (node types, views, etc) and NO breadcrumbs at all on any other one i add this modified function to template.php: http://drupal.org/node/103174#comment-1756386

MGN’s picture

Did you enable 'Set the Home breadcrumb text on all pages' ? Its an 'advanced' option on /admin/settings/custom-breadcrumbs that was just recently added to 6.x-2.x-dev.

vthirteen’s picture

well, no...
and indeed it seems that checking it did the trick.

at first sight i thought that "Set the Home breadcrumb text on all pages" was exactly what i did not want, especially because of its description: "When enabled, the home breadcrumb text will be used on all pages, not just those with defined custom breadcrumbs."

now I guess I understand the logic, but maybe a slight rephrasing would help, like: "Checking this option will let Custom Breadcrumbs take care of front page breadcrumb on all pages where a specific breadcrumb has not been set. If you don't want the front page breadcrumb to be displayed just enable this option and make sure that the "home breadcrumb text" above is empty".

thank you for your help.

MGN’s picture

Component: Code » Documentation
Category: support » task

I think we can implement this on both the admin settings page and the README file, which is lagging the development right now. Thanks for the suggestion.

MGN’s picture

Status: Active » Fixed

I've amended the documentation to incorporate vthirteen's suggestion. http://drupal.org/cvs?commit=254122

Status: Fixed » Closed (fixed)

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