Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1197 diff -u -p -r1.1197 common.inc --- includes/common.inc 30 Jul 2010 02:47:27 -0000 1.1197 +++ includes/common.inc 31 Jul 2010 14:07:26 -0000 @@ -250,6 +250,42 @@ function drupal_get_breadcrumb() { } /** + * Returns a link to the last non-administrative page visited. + */ +function drupal_get_breadcrumb_back() { + if (user_access('access administration pages')) { + // On administrative pages, return the stored link to the last + // non-administrative page visited, if any. + if (path_is_admin($_GET['q'])) { + if (!empty($_SESSION['system_last_non_admin_path'])) { + $link = $_SESSION['system_last_non_admin_path']; + return l($link['text'], $link['path'], $link['options']); + } + } + // On non-administrative pages, store data about the page so that + // administrative pages which the user visits later can link back to this + // page. Don't do it for the front page though, as it would be redundant + // due to the 'Home' entry. + else { + if (!drupal_is_front_page()) { + $title = drupal_get_title(); + $_SESSION['system_last_non_admin_path'] = array( + 'text' => $title, + 'path' => $_GET['q'], + 'options' => array( + 'query' => drupal_get_query_parameters(), + 'title' => t('Back to %page-title', array('%page-title' => $title)), + ), + ); + } + else { + unset($_SESSION['system_last_non_admin_path']); + } + } + } +} + +/** * Returns a string containing RDF namespace declarations for use in XML and * XHTML output. */ @@ -5596,7 +5632,7 @@ function drupal_common_theme() { 'variables' => array('path' => NULL, 'alt' => '', 'title' => NULL, 'attributes' => array(), 'getsize' => TRUE), ), 'breadcrumb' => array( - 'variables' => array('breadcrumb' => NULL), + 'variables' => array('breadcrumb' => NULL, 'back' => NULL), ), 'help' => array( 'variables' => array(), Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.604 diff -u -p -r1.604 theme.inc --- includes/theme.inc 30 Jul 2010 02:47:27 -0000 1.604 +++ includes/theme.inc 31 Jul 2010 13:52:43 -0000 @@ -1528,18 +1528,32 @@ function theme_image($variables) { * @param $variables * An associative array containing: * - breadcrumb: An array containing the breadcrumb links. + * - back: A string containing a link that points to the last + * non-administrative page the user visited. */ function theme_breadcrumb($variables) { $breadcrumb = $variables['breadcrumb']; + $back = $variables['back']; + $output = ''; + if (!empty($back)) { + $output .= ''; + $output .= $back . ' « '; + $output .= ''; + } if (!empty($breadcrumb)) { // Provide a navigational heading to give context for breadcrumb links to // screen-reader users. Make the heading invisible with .element-invisible. - $output = '

' . t('You are here') . '

'; + $output .= '

' . t('You are here') . '

'; + $output .= ''; + $output .= implode(' » ', $breadcrumb); + $output .= ''; + } - $output .= ''; - return $output; + if ($output) { + $output = '