You are here

function Solr_Base_Query::get_breadcrumb in Apache Solr Search 5

Same name and namespace in other branches
  1. 5.2 Solr_Base_Query.php \Solr_Base_Query::get_breadcrumb()
  2. 6 Solr_Base_Query.php \Solr_Base_Query::get_breadcrumb()
  3. 6.2 Solr_Base_Query.php \Solr_Base_Query::get_breadcrumb()

File

./Solr_Base_Query.php, line 195

Class

Solr_Base_Query

Code

function get_breadcrumb() {

  // This encodes an assumption that the breadcrumb is always building off
  // of the current page. Could be a problem.
  $breadcrumb = menu_get_active_breadcrumb();

  // double check that the fields are ordered by position.
  ksort($this->_fields);
  $progressive_crumb = array();

  // TODO: Don't know if hardcoding this is going to come back to bite.
  $base = 'search/' . arg(1) . '/';
  foreach ($this->_fields as $field) {
    $progressive_crumb[] = Solr_Base_Query::make_field($field);
    if (empty($field['#name'])) {
      $breadcrumb[] = l($field['#value'], $base . implode(' ', $progressive_crumb));
    }
    else {
      if ($themed = theme("apachesolr_breadcrumb_{$field['#name']}", $field['#value'])) {
        $breadcrumb[] = l($themed, $base . implode(' ', $progressive_crumb));
      }
      else {
        $breadcrumb[] = l($field['#value'], $base . implode(' ', $progressive_crumb));
      }
    }
  }

  // the last breadcrumb is the current page, so it shouldn't be a link.
  $last = count($breadcrumb) - 1;
  $breadcrumb[$last] = strip_tags($breadcrumb[$last]);
  drupal_set_breadcrumb($breadcrumb);
  return $breadcrumb;
}