You are here

function facetapi_get_min_date in Facet API 7

Same name and namespace in other branches
  1. 6.3 facetapi.callbacks.inc \facetapi_get_min_date()
  2. 7.2 facetapi.callbacks.inc \facetapi_get_min_date()

Callback that returns the minimum date in the node table.

@todo Cache this value.

Parameters

$facet: An array containing the facet definition.

Return value

The minimum time in the node table.

1 string reference to 'facetapi_get_min_date'
facetapi_facetapi_facet_info in ./facetapi.facetapi.inc
Implements hook_facetapi_facet_info().

File

./facetapi.callbacks.inc, line 105
Callbacks referenced in hook implementations.

Code

function facetapi_get_min_date(array $facet) {
  $query = db_select('node', 'n')
    ->condition('status', 1);
  $query
    ->addExpression('MIN(' . $facet['name'] . ')', 'max');
  return $query
    ->execute()
    ->fetch()->max;
}