4.6.x common.inc drupal_set_breadcrumb($breadcrumb = NULL)
4.7.x common.inc drupal_set_breadcrumb($breadcrumb = NULL)
5.x common.inc drupal_set_breadcrumb($breadcrumb = NULL)
6.x common.inc drupal_set_breadcrumb($breadcrumb = NULL)
7.x common.inc drupal_set_breadcrumb($breadcrumb = NULL)

Sets the breadcrumb trail for the current page.


$breadcrumb: Array of links, starting with "home" and proceeding up to but not including the current page.

7 calls to drupal_set_breadcrumb()
blog_view in modules/blog/blog.module
Implements hook_view().
comment_reply in modules/comment/comment.pages.inc
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
drupal_get_breadcrumb in includes/common.inc
Gets the breadcrumb trail for the current page.
forum_node_view in modules/forum/forum.module
Implements hook_node_view().
hook_view in modules/node/node.api.php
Display a node.

... See full list


includes/common.inc, line 243
Common functions that many Drupal modules will need to reference.


function drupal_set_breadcrumb($breadcrumb = NULL) {
  $stored_breadcrumb =& drupal_static(__FUNCTION__);
  if (isset($breadcrumb)) {
    $stored_breadcrumb = $breadcrumb;
  return $stored_breadcrumb;


floatyears’s picture

How can I do to include current page?

fenda’s picture

As far as I can tell, this function hasn't changed since D6.

D6 example:

// Build Breadcrumbs
$breadcrumb = array();
$breadcrumb[] = l('Home', '');
$breadcrumb[] = l('Topics', 'taxonomy/term/1');
$breadcrumb[] = l(drupal_get_title(), base_path() . request_uri()); // Link to current URL

// Set Breadcrumbs
dawnbuie’s picture

Just paste this code into your header area for the taxonomy view. The %1 is the replacement variable for the first argument - the Term name in this case. Presumably you don't want to link to the term if you are currently on the term page.

// Build Breadcrumbs
$breadcrumb = array();
$breadcrumb[] = l('Home', '<front>');
$breadcrumb[] = l('Topics', 'taxonomy/term/1');
$breadcrumb[] = %1 ; 

// Set Breadcrumbs
ultimateboy’s picture

You should use t() here for translations.

$crumbs = array();
$crumbs[] = l(t('Home'), '');
$crumbs[] = l(t('Topics'), 'taxonomy/term/1');
ssg141’s picture

You can do something like this in the template.php:

function myThemeName_breadcrumb($variables) {
  $breadcrumb = $variables['breadcrumb'];

  if (!empty($breadcrumb)) {
    // Adding the title of the current page to the breadcrumb.
    $breadcrumb[] = drupal_get_title();
    // Provide a navigational heading to give context for breadcrumb links to
    // screen-reader users. Make the heading invisible with .element-invisible.
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';

    $output .= '<div class="breadcrumb">' . implode(' › ', $breadcrumb) . '</div>';
    return $output;
pglynn’s picture

This works like it should, but it ignores any theme settings that might override breadcrumbs being set at all. Omega theme offers the ability to turn off breadcrumbs and should be evaluated in this scenario.

Adding the following to the top part of your function does the trick:

  //function theme...(){
  $theme = alpha_get_theme();
  // Check to see if breadcrumbs are supported by this theme
  $variables['breadcrumb'] = $theme->settings['toggle']['breadcrumb'] ? $variables['breadcrumb'] : NULL;

  // your code continues....
  $breadcrumb = $variables['breadcrumb'];
ssg141’s picture

@floatyears note that the title added (above) to the end of the breadcrumb will not be a link (to the current page itself)

rmathew’s picture

To add the title as a link:
$breadcrumb[] = l(drupal_get_title(), current_path());

nidhitiwari’s picture

Hi Guys,
I have fix my issue by using below code. May be it can be useful for some one :)
function ThemeName_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
$arguments = explode('/', request_uri());
foreach ($arguments as $key => $value) {
$breadcrumb[] = l('Products', '/products/products');
$breadcrumb[] = l('Products By Industry Application', '/products/products-industry-application');
if (!empty($breadcrumb)) {
$crumbs = '<ol class="breadcrumb breadcrumb-list">';
foreach($breadcrumb as $value) {
$crumbs .= '<li>'.$value.'</li>';
$crumbs .= '<li>'.$cat.'</li>';
$crumbs .= '<li>'. drupal_get_title() .'</li></ol>';
return $crumbs;