You are here

function theme_finder_views_results in Finder 6

Same name and namespace in other branches
  1. 7 modules/finder_views/finder_views.module \theme_finder_views_results()

Theme the views finder results.

Parameters

$results: An array of result objects.

$finder: The finder object.

$form_state: The Forms API form state.

1 theme call to theme_finder_views_results()
finder_views_finder_result in modules/finder_views/finder_views.module
Implementation of hook_finder_result().

File

modules/finder_views/finder_views.module, line 604
The finder views module.

Code

function theme_finder_views_results($results, $finder, $form_state) {
  $output = '';
  foreach ($results as $key => $result) {

    // Open the results wrapper
    $output .= '<div id="finder-views-result-' . $key . '" class="finder-views-result">';

    // Output the identity of this result object
    $id =& $result->{$result->base_field};
    $path = finder_views_path($result->base_table, $id);
    $id_output = $path ? l($id, $path) : $id;
    $identity = $result->base_table . ', ' . $result->base_field . ': ' . $id_output;
    $output .= '<div class="identity">' . $identity . '</div>';

    // Output a list of finder element titles and the submitted keywords.
    if (!empty($result->field_names)) {
      $keywords = array();
      foreach ($result->field_names as $finder_element_id => $element_fields) {
        $element =& finder_element($finder, $finder_element_id);
        $element_output = '<span class="element-title">' . $element->title . ': </span>';
        $element_values = array();
        foreach ($element_fields as $field_name) {
          if (!empty($result->{$field_name})) {
            $element_values[] = $result->{$field_name};
          }
        }
        $element_output .= implode(', ', $element_values);
        $keywords[] = $element_output;
      }
      $output .= '<div class="keywords">' . implode('<br>', $keywords) . '</div>';
    }

    // Close the results wrapper
    $output .= '</div>';
  }
  return $output;
}