Here is a Drupal custom breadcrumb for content type snippet that I used to build a nice long breadcrumb chain for a specific content type.
I implemented a hook_page_alter
in a custom module where I modified the $breadcrumb array to mi liking. Here is the snippet.
/**
* Implements hook_page_alter
*/
function MODULENAME_page_alter(&$page) {
$node = menu_get_object();
if (!empty($node->type) && ($node->type == 'CONTENT_TYPE')) {
$breadcrumbs = array();
$breadcrumbs[] = l(t('Home'), '<front>');
$breadcrumbs[] = l('Administration', '/admin');
$breadcrumbs[] = l('Statistics', '/admin/statistics');
$breadcrumbs[] = l('Sent Email', '/admin/statistics/emails');
drupal_set_breadcrumb($breadcrumbs);
// Bonnus I also needed to add some custom CSS for this page
drupal_add_css(drupal_get_path('module', 'MODULENAME') . '/css/CONTENT_TYPE.css', array('group' => CSS_DEFAULT, 'type' => 'file'));
}
}
Be sure to change MODULENAME
to your own module name and CONTENT_TYPE
to your own content type. Build the $breadcrumb array as you wish.
I initialize the $breacrumb variable as an empty array then just keep adding links to it that were formed with the l
function. Then use the drupal_set_breadcrumb
function to set is as the breadcrumb.
Cheers!