function _datex_date_field_has_granularity in Datex 7.3
Check and see if a field is configured to have a granularity or not.
This is a helper function.
1 call to _datex_date_field_has_granularity()
- _datex_fix_missing_granularity in ./
datex_date.inc - Helper function.
File
- ./
datex_date.inc, line 63 - Provides support for date module.
Code
function _datex_date_field_has_granularity(array $element, $granul) {
$gr = _datex_date_field_granularity($element);
switch ($granul) {
case 'time':
return in_array('hour', $gr, TRUE) || in_array('minute', $gr, TRUE) || in_array('second', $gr, TRUE);
case 'mad':
// Month and day
return in_array('month', $gr, TRUE) && in_array('day', $gr, TRUE);
case 'mod':
// Month or day
return in_array('month', $gr, TRUE) || in_array('day', $gr, TRUE);
default:
return in_array($granul, $gr, TRUE);
}
}