You are here

function facetapi_callback_min_date in Facet API 6

Callback that returns the minimum date in the node table.

Parameters

$facet: An array containing the facet definition.

Return value

The minimum time in the node table.

1 string reference to 'facetapi_callback_min_date'
facetapi_facetapi_facet_info in ./facetapi.module
Implementation of hook_facetapi_facet_info().

File

./facetapi.callbacks.inc, line 228
Various callbacks referenced in facet definitions.

Code

function facetapi_callback_min_date(array $facet) {

  // @todo is this the appropriate escaping function??
  $table = db_escape_table($facet['field']);
  $sql = "SELECT MIN({$table}) FROM {node} WHERE status = 1";
  if ($result = db_query($sql)) {
    if ($date = db_result($result)) {
      return $date;
    }
  }
  return FALSE;
}