"Administer" link gets removed from breadcrumb

nadavoid - March 27, 2009 - 23:23
Project:Menu Breadcrumb
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

When in the admin section of the site, the main "Administer" link of the breadcrumb gets removed when using this module. This happens when the option is checked "Use menu the page belongs to for the breadcrumb" at admin/settings/menu_breadcrumb.

The attached patch addresses this by checking to see if the current path is in the admin section of the site before adjusting the menu. it amounts to wrapping an "if" around the meat of the menu_breadcrumb_init() function. (The patch is longer because of the extra tabbing. There are actually only two new lines.)

Here is the entire updated function...

<?php
function menu_breadcrumb_init() {
  if (
arg(0) != 'admin') {
    if (
variable_get('menu_breadcrumb_determine_menu', 1)) {
     
$menu_item = menu_get_item();
     
$menu_link = menu_link_load(db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s'", $menu_item['href'])));
     
$use_menu = $menu_link['menu_name'];
     
menu_set_active_menu_name($use_menu);
    }

   
$breadcrumb = drupal_get_breadcrumb();
 
    if (
variable_get('menu_breadcrumb_append_node_title', 0) == 1) {
      if (
variable_get('menu_breadcrumb_append_node_url', 0) == 1) {
       
$breadcrumb[] = l(drupal_get_title(), $_GET['q']);
      }
      else {
       
$breadcrumb[] = drupal_get_title();
      }
    }
   
    if (
count($breadcrumb) == 1 && variable_get('menu_breadcrumb_hide_on_single_item', 0)) {
     
$breadcrumb = array();
    }
   
   
drupal_set_breadcrumb($breadcrumb);
  }
}
?>

AttachmentSize
admin_001.patch1.89 KB
 
 

Drupal is a registered trademark of Dries Buytaert.