You are here

function finder::fields in Finder 7.2

Finder fields.

Gets the list of possible fields that can be used with this finder.

File

includes/finder.inc, line 1001
finder.inc

Class

finder
An object to contain all of the data to generate a finder, plus the member functions to build the finder, and render the output.

Code

function fields($groups = TRUE, $title_only = TRUE) {
  if ($view = views_get_view($this->views_view)) {
    views_include('admin');
    $display = $view
      ->add_display('finder_views');
    $view
      ->set_display($display);
    $base_tables = $view
      ->get_base_tables();
    $views_fields = views_fetch_fields(array_keys($base_tables), 'filter');
    if (!empty($views_fields['search_index.keys'])) {

      // Special case, allow search indexes to work. #1410862
      $views_fields['search_index.word'] = $views_fields['search_index.keys'];
      unset($views_fields['search_index.keys']);
    }
    $options = array();
    foreach ($views_fields as $k => $v) {
      if ($groups) {
        $options[$v['group']][$k] = $title_only ? $v['title'] : $v;
      }
      else {
        $options[$k] = $title_only ? $v['title'] : $v;
      }
    }
    return $options;
  }
  return FALSE;
}