You are here

function date_granularity_array in Date 5

$field['granularity'] will contain an array like ('H' => 'H', 'M' => 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

7 calls to date_granularity_array()
date_copy_convert_events in ./date_copy.module
date_field in ./date.module
Implementation of hook_field().
date_field_object in ./date.module
Use the Date API to get an object representation of a date field
date_set_formats in ./date.module
date_views_date_range in ./date_views.inc

... See full list

File

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

Code

function date_granularity_array($field) {
  if (!is_array($field) || !is_array($field['granularity'])) {
    $field['granularity'] = drupal_map_assoc(array(
      'Y',
      'M',
      'D',
    ));
  }
  return array_values(array_filter($field['granularity']));
}