function partial_date_granularity_field_options in Partial Date 7
Returns option lists for the various components, with the exception of year which is not supported.
Parameters
string $type: One of the date granularity keys: year, month, day, etc.
array $options: Additional values to prefix onto the options list.
1 call to partial_date_granularity_field_options()
- _partial_date_element_process in ./
partial_date.admin.inc - Roll out a single date element.
File
- ./
partial_date.module, line 1104 - Defines a date element that allows for any combination of date granularity settings.
Code
function partial_date_granularity_field_options($type, $options = array(), $increment = 1) {
switch ($type) {
case 'second':
case 'minute':
return $options + date_minutes('i', FALSE, $increment);
case 'hour':
return $options + drupal_map_assoc(range(0, 23));
case 'day':
return $options + drupal_map_assoc(range(1, 31));
case 'month':
return $options + drupal_map_assoc(range(1, 12), 'map_month');
case 'timezone':
// Ref: Date API module
return $options + date_timezone_names(TRUE);
case 'year':
default:
return $options;
}
}