You are here

function theme_apachesolr_breadcrumb_cck in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 5.2 apachesolr_search.module \theme_apachesolr_breadcrumb_cck()

Theme function for CCK fields in breadcrumbs. TODO: The logic for getting here is too convoluted, and there are too many bizarre naming conventions in play (_cck_, _end). The checks for _cck_ and _end MUST get refactored.

File

./apachesolr_search.module, line 1444
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function theme_apachesolr_breadcrumb_cck($field) {
  $matches = preg_split('/_cck_/', $field['#name']);
  if (isset($matches[1])) {
    $match = $matches[1];

    // TODO: If the apachesolr_date module is present we might
    // have fields with the suffix '_end'. These are the end-dates
    // and need the suffix removed.
    if (module_exists('apachesolr_date')) {
      $match = preg_replace('/_end{1}$/', '', $match);
    }
    $mappings = apachesolr_cck_fields();
    if (isset($mappings[$match]['display_callback'])) {
      $function = $mappings[$match]['display_callback'];
      if (function_exists($function)) {
        $facet = $field['#value'];
        $options = array_merge($mappings[$match], array(
          'delta' => $matches[1],
        ));
        return $function($facet, $options);
      }
    }
  }
  return $field['#value'];
}