You are here

function _calendar_systems_get_granularity_part in Calendar Systems 7

Same name and namespace in other branches
  1. 8 calendar_systems.helpers.inc \_calendar_systems_get_granularity_part()
  2. 7.2 calendar_systems.helpers.inc \_calendar_systems_get_granularity_part()

Parameters

$format:

Return value

array

2 calls to _calendar_systems_get_granularity_part()
calendar_systems_date_popup_process_alter in ./calendar_systems.module
Supporing date module's date_popup element hook_date_popup_process_alter
_calendar_systems_get_format_part in ./calendar_systems.helpers.inc

File

./calendar_systems.helpers.inc, line 47

Code

function _calendar_systems_get_granularity_part($part, $granularity) {
  $result = array();
  foreach ($granularity as $value) {
    switch ($part) {
      case 'date':
        if (in_array($value, array(
          'year',
          'month',
          'day',
        ))) {
          $result[] = $value;
        }
        break;
      case 'time':
        if (in_array($value, array(
          'hour',
          'minute',
          'second',
          'timezone',
        ))) {
          $result[] = $value;
        }
        break;
      default:
    }
  }
  return $result;
}