Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Special Menu Items and Breadcrumbs

Parent Feed: 

If you are using the Special Menu Items module to add things like HRs and unlinked titles to your menus, you might run into the Breadcrumb issue.

If you have a non-linked menu item it may show up on your breadcrumbs as a plain text title which you may not want to see. There are a number of issues for this in the modules queue, but as far as I can tell it has not been fixed.

My quick fix is a function in template.php

function ems_college_process_page(&$variables) {
    // Add support for the breadcrumb : nolinks would be still available leading to 404
    $item = menu_get_item();
    $trail = menu_get_active_trail();
    foreach ($trail as $key => $value) {
        if($trail[$key]['href'] == '<nolink>') {
            unset($trail[$key]);
            menu_set_active_trail($trail);
            drupal_alter('menu_breadcrumb', $trail, $item);
            $variables['breadcrumb'] = theme('breadcrumb', array('breadcrumb' => menu_get_active_breadcrumb()));
               }
        }
}

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web