I need to display a breadcrumb per content type and per role. What the best way to do it. I've tried a lot of module and none fit my needs.

I tried overwritting breadcrumb in template.php as follow, and it's not working :

function local_breadcrumb($variables) {
  $output = '';

  global $user;
  /** Breadcrumb for hsrehab_admin **/
  if(in_array('hsrehab_admin', $user->roles)) {
   if ($vars['node']->type == 'patient_sheet') {
     // Build Breadcrumbs
     $breadcrumb = array();
     $breadcrumb[] = l('Dashboard', '');
     $breadcrumb[] = l('Manage Patients', '/admin/manage-patients');
     $breadcrumb[] = l(drupal_get_title(), base_path() . request_uri());

  // Determine if we are to display the breadcrumb.
  $bootstrap_breadcrumb = bootstrap_setting('breadcrumb');
  if (($bootstrap_breadcrumb == 1 || ($bootstrap_breadcrumb == 2 && arg(0) == 'admin')) && !empty($breadcrumb)) {
    $output = theme('item_list', array(
      'attributes' => array(
        'class' => array('breadcrumb container'),
      'items' => $breadcrumb,
      'type' => 'ol',
  return $output;
  • can you modify the breadcrumbs in the template for each content type? – longboardnode Jul 21 '17 at 16:07
  • I don't know, that's a good question. Should I make a module ? – Aporie Jul 22 '17 at 10:42
  • Which modules did you try? – donquixote Jul 22 '17 at 15:15
  • And can you start with a simpler version of the code above, where the breadcrumb is always altered no matter the user role and node type? Just to see if it works. – donquixote Jul 22 '17 at 15:19
  • Hey, I finally used Path bredcrumbs and succeed to do what I wanted. Thanks for your answers. – Aporie Jul 25 '17 at 12:02

You can create a theme template for each content type, then add the breadcrumb logic in there and output the modified breadcrumb there. Here's a great DO resource for theming and how to use template files. In a nutshell, you can clone your default page.tpl.php and rename it page--patient_sheet.tpl.php and inside this template you can run and output the breadcrumb logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.