You are here

function datex_date_field_widget_settings_form_alter in Datex 7.2

Same name and namespace in other branches
  1. 7.3 datex_date.inc \datex_date_field_widget_settings_form_alter()

Implements hook_date_field_instance_settings_form_alter().

For per-field control.

File

./datex_date.inc, line 273
Provides Jalali support for date module.

Code

function datex_date_field_widget_settings_form_alter(&$form, $context) {
  $settings = $context['instance']['widget']['settings'];
  if (!_datex_date_granularities_supported($context['field']['settings']['granularity'])) {
    $options = array(
      'disabled' => t('Force disabled (Field not supported)'),
    );
    $default = 'disabled';
    $desc = t('Datex is disabled for fields without month granularity but with smaller granularity.');
  }
  else {
    $options = _datex_options();
    $default = isset($settings['datex_schema']) ? $settings['datex_schema'] : 'default';
    $desc = '';
  }
  $form['datex_schema'] = array(
    '#title' => t('Datex schema to use for this field.'),
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => $default,
    '#description' => $desc,
  );
}