You are here

function date_granularity in Date 5.2

Same name and namespace in other branches
  1. 8 date.module \date_granularity()
  2. 6.2 date/date.module \date_granularity()
  3. 6 date/date.module \date_granularity()
  4. 7.3 date.module \date_granularity()
  5. 7 date.module \date_granularity()
  6. 7.2 date.module \date_granularity()

$field['granularity'] will contain an array like ('hour' => 'hour', 'month' => 0) where the values turned on return their own names and the values turned off return a zero need to reconfigure this into a simple array of the turned on values

5 calls to date_granularity()
date_copy_import_ical_form_submit in date_copy/date_copy.module
date_formatter_format in date/date.module
Helper function to return the date format used by a specific formatter.
_date_field_update in date/date_elements.inc
Private implementation of hook_field update and insert operations.
_date_views_filter_handler in date/date_views.inc
_date_views_handler_filter_date_value_form in date/date_views.inc
Provide a form gadget for dates.

File

date/date.module, line 293
Defines date/time field types for the Content Construction Kit (CCK).

Code

function date_granularity($field) {
  if (!is_array($field) || !is_array($field['granularity'])) {
    $field['granularity'] = drupal_map_assoc(array(
      'year',
      'month',
      'day',
    ));
  }
  return array_values(array_filter($field['granularity']));
}