You are here

function facetapi_get_max_date in Facet API 7

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

Callback that returns the minimum value 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_max_date'
facetapi_facetapi_facet_info in ./facetapi.facetapi.inc
Implements hook_facetapi_facet_info().

File

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

Code

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