You are here

function date_views_fields in Date 8

Same name and namespace in other branches
  1. 7.3 date_views/date_views.module \date_views_fields()
  2. 7 date_views/includes/date_views.views.inc \date_views_fields()
  3. 7.2 date_views/date_views.module \date_views_fields()

Identify all potential date/timestamp fields and cache the data.

7 calls to date_views_fields()
date_views_argument_handler::admin_summary in date_views/includes/date_views_argument_handler.inc
date_views_argument_handler::get_query_fields in date_views/includes/date_views_argument_handler.inc
Collect information about our fields we will need to create the right query.
date_views_argument_handler::options_form in date_views/includes/date_views_argument_handler.inc
Add a form element to select date_fields for this argument.
date_views_argument_handler_simple::query in date_views/includes/date_views_argument_handler_simple.inc
Inject a test for valid date range before the regular query. Override the parent query to be able to control the $group.
date_views_filter_handler::admin_summary in date_views/includes/date_views_filter_handler.inc

... See full list

File

date_views/date_views.module, line 52

Code

function date_views_fields($base = 'node', $reset = FALSE) {
  static $fields = array();
  $empty = array(
    'name' => array(),
    'alias' => array(),
  );
  module_load_include('inc', 'date_views', 'includes/date_views_fields');
  if (empty($fields[$base]) || $reset) {
    $cid = 'date_views_fields_' . $base;
    if (!$reset && ($cached = cache_get($cid, 'cache_views'))) {
      $fields[$base] = $cached->data;
    }
    else {
      $fields[$base] = _date_views_fields($base);
    }
  }

  // Make sure that empty values will be arrays in he expected format.
  return !empty($fields) && !empty($fields[$base]) ? $fields[$base] : $empty;
}