function drupal_set_breadcrumb

You are here

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

Set the breadcrumb trail for the current page.

Parameters

$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
Implementation of 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
Get the breadcrumb trail for the current page.
forum_nodeapi in modules/forum/forum.module
Implementation of hook_nodeapi().
hook_view in developer/hooks/node.php
Display a node.

... See full list

File

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

Code

function drupal_set_breadcrumb($breadcrumb = NULL) {
  static $stored_breadcrumb;

  if (!is_null($breadcrumb)) {
    $stored_breadcrumb = $breadcrumb;
  }
  return $stored_breadcrumb;
}

Comments

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

// Set Breadcrumbs

drupal_set_breadcrumb($breadcrumb);
?>

Make sure you run the link text through t() before setting the breadcrumb.

Beware if you do not check 'Show home page link in breadcrumb' in your theme configuration under the breadcrumb settings, then the first element in your $breadcrumb array sent to drupal_set_breadcrumb will not be shown (ie. the first element is what drupal considers the home link on the theme config page).