You are here

function _partial_date_expand_estimate in Partial Date 7

1 call to _partial_date_expand_estimate()
partial_date_field_load in ./partial_date.module
Implements hook_field_load().

File

./partial_date.module, line 171
Defines a date element that allows for any combination of date granularity settings.

Code

function _partial_date_expand_estimate($key, &$item, $estimates, $is_start = TRUE) {
  $item[$key . '_estimate_label'] = '';
  $item[$key . '_estimate_value'] = NULL;
  $value = $item[$key . '_estimate'];
  if (!empty($value)) {
    if (!empty($estimates[$key][$value])) {
      $item[$key . '_estimate_label'] = $estimates[$key][$value];
    }
    list($start, $end) = explode('|', $value);
    $item[$key . '_estimate_value'] = $is_start ? $start : $end;
  }
}