I was having trouble removing the 'title' from the end of the breadcrumb from search results (using apachesolr - but I am pretty sure standard drupal does the same) pages. Out of the box it is (upon a search for the word 'student'):

Home › Search › Site › student › Site

Using theming I was able to remove the 3rd breadcrumb 'Site', my code below in template.php:

function MYTHEME_menu_breadcrumb_alter(&$active_trail, $item) {
  // we want remove the extra breadcrumbs on search pages as of the box they are
  // Home › Search › Site › student › Site
  // Note the extra 'Site' breadcrumbs in there
  else if (arg(0) == 'search') {
    foreach ($active_trail as $index => $breadcrumb) {
      if (isset($breadcrumb['link_title']) && $breadcrumb['link_title'] == 'Site') {
        unset($active_trail[$index]);
      }
    }
  }
}

Now the breadcrumb looks like

Home › Search › student › Site

But I don't see a way to remove the 'title' from the end of the breadcrumb trail. It is not a breadcrumb in the traditional sense as it is added by zen_breadcrumb, and thus my hook_menu_breadcrumb_alter() does not have access to remove it.

Attached is a patch that removes the 'title' and trailing seperator from the end of the breadcrumb trail when on search results landing pages

If there are any better ideas on doing this, let me know

Comments

Title:Extra unnecessary breadcrumb on search results pagesExtra unnecessary breadcrumb on search results pages (allow themes to modify the breadcrumb settings dynamically)
Version:7.x-3.1» 7.x-5.x-dev
StatusFileSize
new4.01 KB

This might be expanding the issue a bit, but I think having Zen try to deal directly with this particular search scenario may be a bit too specific.

I think the underlying issue here is that there is no good way for a particular subtheme or site to easily alter Zen's breadcrumb display on a case-by-case basis. It's possible to override zen_breadcrumb() entirely, of course, but that's a lot of code and logic for a small change. I think as a base theme, it would be a good idea for Zen to make its theme function as flexible as possible.

This patch therefore removes the hardcoded theme_get_setting() calls from zen_breadcrumb() and adds them as a variable in a preprocess function. That way, subthemes (or even modules) can easily implement preprocess/process functions of their own to modify the breadcrumb displays settings in a particular case or anything else they want to do.

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

You can toggle the title being added to the end of the breadcrumb with theme_get_setting('zen_breadcrumb_title')

Version:7.x-5.x-dev» 7.x-6.x-dev
Status:Postponed (maintainer needs more info)» Needs review

Been thinking about this one for a while and I agree with your point. It's obvious we shouldn't be querying the database from a template file, neither should we be using theme_get_setting().

But I'm not sure changing the internals of this theme function is safe to do in 7.x-5.x branch without breaking existing sites.