diff --git a/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs_identifiers/custom_breadcrumbs_identifiers.module b/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs_identifiers/custom_breadcrumbs_identifiers.module index 743f8cd..ae066a1 100644 --- a/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs_identifiers/custom_breadcrumbs_identifiers.module +++ b/sites/all/modules/custom_breadcrumbs/custom_breadcrumbs_identifiers/custom_breadcrumbs_identifiers.module @@ -24,6 +24,8 @@ function custom_breadcrumbs_identifiers_cb_identifier_list() { $identifiers[''] = t('Provides crumbs for each parent node of a book page. Whatever is placed in the corresponding position of the title area will be ignored. It should not be used with the pipe (|) symbol.'); $identifiers[''] = t('Provides a plain text crumb using the page title. Whatever is placed in the corresponding position of the title area will be ignored. It should not be used with the pipe (|) symbol.'); $identifiers[''] = t('Produces crumbs for each parent item for the given path. The title information for this line will be ignored because the menu link titles are used. If a path is not provided following the pipe (|) symbol, the current path with be used.'); + $identifiers[''] = t('Produces a crumb for the given path. The title information for this line will be ignored because the menu link title is used. If a path is not provided following the pipe (|) symbol, the current path with be used.'); + $identifiers[''] = t('Produces a crumb for the given menu item ID. The title information for this line will be ignored because the menu link title is used. If a path is not provided following the pipe (|) symbol, the current path with be used.'); return $identifiers; } @@ -179,7 +181,57 @@ function custom_breadcrumbs_identifiers_cb_identifier_values($identifier, $obj) return array(); } break; + + // Support for showing a paths parent menu link items as crumbs. + case '': + $title = $obj['title']; + $path = ($obj['path'] != '') ? $obj['path'] : $_GET['q']; + $attributes = $obj['attributes']; + + // Search for both alias and normal path. + $normal_path = drupal_get_normal_path($path); + + $query = "SELECT * FROM {menu_links} WHERE link_path IN ('%s', '%s')"; + $menu_item = db_fetch_object(db_query_range($query, $normal_path, $path, 0, 1)); + + if ($menu_item) { + $trail[$i] = array( + 'title' => $menu_item->link_title, + 'href' => $menu_item->link_path, + 'crumb' => l($menu_item->link_title, $menu_item->link_path, $attributes), + ); + return $trail; + } + // Return an empty array if no menu entry is given. + else { + return array(); } + break; + + // Support for showing a paths parent menu link items as crumbs. + case '': + $title = $obj['title']; + $path = ($obj['path'] != '') ? $obj['path'] : $_GET['q']; + $attributes = $obj['attributes']; + + $query = "SELECT * FROM {menu_links} WHERE mlid = %d"; + $menu_item = db_fetch_object(db_query_range($query, $path, 0, 1)); + + if ($menu_item) { + $trail[$i] = array( + 'title' => $menu_item->link_title, + 'href' => $menu_item->link_path, + 'crumb' => l($menu_item->link_title, $menu_item->link_path, $attributes), + ); + return $trail; + } + // Return an empty array if no menu entry is given. + else { + return array(); + } + break; + } + return $crumb_items; }