function adaptivetheme_breadcrumb

cis7 theme.inc adaptivetheme_breadcrumb($vars)
cle7 theme.inc adaptivetheme_breadcrumb($vars)
elmsmedia7 theme.inc adaptivetheme_breadcrumb($vars)
icor7 theme.inc adaptivetheme_breadcrumb($vars)
meedjum_blog7 theme.inc adaptivetheme_breadcrumb($vars)
mooc7 theme.inc adaptivetheme_breadcrumb($vars)

Returns HTML for a breadcrumb trail.

Adaptivetheme renders breadcrumbs as an ordered list (<ol>...</ol>), wrapping crumbs in li elements and the seperators in span elements. Additionally .crumb, .crumb-first and .crumb-last classes are printed on the li elements. We also remove some silly breadcrumbs from various pages.

Parameters

$vars: An associative array containing:

  • breadcrumb: An array containing the breadcrumb links.

File

sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc, line 78
Custom theme functions and theme function overrides.

Code

function adaptivetheme_breadcrumb($vars) {
  global $theme_key;
  $theme_name = $theme_key;
  $breadcrumb = $vars['breadcrumb'];

  if (at_get_setting('breadcrumb_display', $theme_name) == 1) {

    if (at_get_setting('breadcrumb_home', $theme_name) == 0) {
      array_shift($breadcrumb);
    }

    // Remove the rather pointless breadcrumbs for reset password and user
    // register pages, they link to the page you are on, doh!
    if (arg(0) === 'user' && (arg(1) === 'password' || arg(1) === 'register')) {
      array_pop($breadcrumb);
    }

    if (!empty($breadcrumb)) {

      $separator = filter_xss_admin(at_get_setting('breadcrumb_separator', $theme_name));

      // Push the page title onto the end of the breadcrumb array
      if (at_get_setting('breadcrumb_title', $theme_name) == 1) {
        if ($page_title = drupal_get_title()) {
          $breadcrumb[] = '<span class="crumb-title">' . $page_title . '</span>';
        }
      }

      $class = 'crumb';
      end($breadcrumb);
      $last = key($breadcrumb);

      $output = '';
      if (at_get_setting('breadcrumb_label', $theme_name) == 1) {
        $output = '<div id="breadcrumb" class="clearfix"><nav class="breadcrumb-wrapper with-breadcrumb-label clearfix" role="navigation" aria-labelledby="breadcrumb-label">';
        $output .= '<h2 id="breadcrumb-label" class="breadcrumb-label">' . t('You are here') . '</h2>';
      }
      else {
        $output = '<div id="breadcrumb" class="clearfix"><nav class="breadcrumb-wrapper clearfix" role="navigation" aria-labelledby="breadcrumb-label">';
        $output .= '<h2 id="breadcrumb-label" class="element-invisible">' . t('You are here') . '</h2>';
      }
      $output .= '<ol id="crumbs" class="clearfix">';
      foreach ($breadcrumb as $key => $crumb) {
        if ($key == $last && count($breadcrumb) != 1) {
          $class = 'crumb crumb-last';
        }
        if ($key == 0) {
          $output .= '<li class="' . $class . ' crumb-first">' . $crumb . '</li>';
        }
        else {
          $output .= '<li class="' . $class . '"><span class="crumb-separator">' . $separator . '</span>' . $crumb . '</li>';
        }
      }
      $output .= '</ol></nav></div>';

      return $output;
    }
  }
  else {
    return;
  }
}