Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.773
diff -u -p -r1.773 common.inc
--- includes/common.inc	24 Jun 2008 22:09:52 -0000	1.773
+++ includes/common.inc	30 Jun 2008 15:50:19 -0000
@@ -73,14 +73,19 @@ function drupal_get_content($region = NU
  * @param $breadcrumb
  *   Array of links, starting with "home" and proceeding up to but not including
  *   the current page.
- */
-function drupal_set_breadcrumb($breadcrumb = NULL) {
-  static $stored_breadcrumb;
-
-  if (!is_null($breadcrumb)) {
-    $stored_breadcrumb = $breadcrumb;
+ * @param $weight
+ *   Optional weight - if multiple breadcrumbs are set with the same weight,
+ *   each subsequent one will overwrite the previous one.  The stored breadcrumb
+ *   with the lowest weight will be output to the page.
+ */
+function drupal_set_breadcrumb($breadcrumb = NULL, $weight = 0) {
+  static $stored_breadcrumb = array();
+
+  if (isset($breadcrumb)) {
+    $stored_breadcrumb[$weight] = $breadcrumb;
+    ksort($stored_breadcrumb, SORT_NUMERIC);
   }
-  return $stored_breadcrumb;
+  return current($stored_breadcrumb);
 }
 
 /**
@@ -89,8 +94,9 @@ function drupal_set_breadcrumb($breadcru
 function drupal_get_breadcrumb() {
   $breadcrumb = drupal_set_breadcrumb();
 
-  if (is_null($breadcrumb)) {
+  if ($breadcrumb === FALSE) {
     $breadcrumb = menu_get_active_breadcrumb();
+    drupal_set_breadcrumb($breadcrumb);
   }
 
   return $breadcrumb;
