You are here

function date_get_formats in Date 5

Same name and namespace in other branches
  1. 6.2 date_api.module \date_get_formats()
5 calls to date_get_formats()
date_field in ./date.module
Implementation of hook_field().
date_widget in ./date.module
Implementation of hook_widget().
_date_views_filters in ./date_views.inc
Views filters for Date fields.
_date_views_filter_handler in ./date_views.inc
_date_views_handler_filter_date_value_form in ./date_views.inc
Provide a form gadget for dates.

File

./date.module, line 533
Defines a date/time field type.

Code

function date_get_formats($field) {
  if ($cached = cache_get('date_formats:' . $field['field_name'] . ':' . $field['widget']['type'], 'cache') && $cached->data) {
    $formats = unserialize($cached->data);

    // are we up-to-date with current site-wide format ?
    if ($field['widget']['input_format'] != 'site-wide' || $formats['input']['site-wide'] == variable_get('date_format_short', 'm/d/Y - H:i')) {
      return $formats;
    }
  }

  // if we get there, it means we have to (re)generate the formats
  return date_set_formats($field);
}