You are here

function _datex_granularity_supported in Datex 7.3

Checks to see if a field is supported.

If month is present, Then it's supported. But if month is not present then none of smaller granularities should be present either, Otherwise it's impossible to calculate correct date, Since date module sets month to 1.

it's still possible to support it. But I'm really tired to do so, and who wants year and day, without month?!

5 calls to _datex_granularity_supported()
datex_date_field_formatter_settings_form_alter in ./datex_date.inc
Implements hook_date_field_formatter_settings_form_alter().
datex_date_field_formatter_settings_summary_alter in ./datex_date.inc
Implements hook_date_field_formatter_settings_summary_alter().
datex_date_field_widget_settings_form_alter in ./datex_date.inc
Implements hook_date_field_instance_settings_form_alter().
datex_date_select_process_alter in ./datex_date.inc
Implements hook_date_select_process_alter().
_datex_date_field_calendar in ./datex_date.inc
Create a datex-calendar based on field config and the schema set for it.

File

./datex_date.inc, line 20
Provides support for date module.

Code

function _datex_granularity_supported($g) {
  if (is_string($g)) {
    return in_array($g, [
      'year',
      'month',
    ]);
  }

  // Year is always there.
  return count($g) === 1 || in_array('month', $g);
}