You are here

public function Solr_Base_Query::get_breadcrumb in Apache Solr Search 6

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

Build additional breadcrumb elements relative to $base.

File

./Solr_Base_Query.php, line 364

Class

Solr_Base_Query

Code

public function get_breadcrumb($base = NULL) {
  $breadcrumb = array();
  $progressive_crumb = array();
  if (!isset($base)) {
    $base = $this
      ->get_path();
  }
  $search_keys = $this
    ->get_query_basic();
  if ($search_keys) {
    $breadcrumb[] = l($search_keys, $base);
  }
  foreach ($this->fields as $field) {
    $name = $field['#name'];

    // Look for a field alias.
    if (isset($this->field_map[$name])) {
      $field['#name'] = $this->field_map[$name];
    }
    $progressive_crumb[] = $this
      ->make_filter($field);
    $options = array(
      'query' => 'filters=' . rawurlencode(implode(' ', $progressive_crumb)),
    );
    if ($themed = theme("apachesolr_breadcrumb_" . $name, $field['#value'], $field['#exclude'])) {
      $breadcrumb[] = l($themed, $base, $options);
    }
    else {
      $breadcrumb[] = l($field['#value'], $base, $options);
    }
  }
  if (!empty($breadcrumb)) {

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