You are here

function chosen_form_field_ui_field_edit_form_alter in Chosen 7.2

Same name and namespace in other branches
  1. 6 chosen.module \chosen_form_field_ui_field_edit_form_alter()
  2. 7.3 chosen.module \chosen_form_field_ui_field_edit_form_alter()
  3. 7 chosen.module \chosen_form_field_ui_field_edit_form_alter()

Implements hook_form_FORM_ID_alter().

File

./chosen.module, line 72
General functions and hook implementations.

Code

function chosen_form_field_ui_field_edit_form_alter(&$form, $form_state) {
  if (empty($form['#field']['locked']) && isset($form['#instance']['widget']['settings']['apply_chosen'])) {
    $form['instance']['widget']['settings']['apply_chosen'] = array(
      '#type' => 'select',
      '#title' => t('Apply Chosen to the select fields in this widget?'),
      '#options' => array(
        0 => t('Do not apply'),
        1 => t('Apply'),
      ),
      '#default_value' => $form['#instance']['widget']['settings']['apply_chosen'],
      '#disabled' => !chosen_get_chosen_path(),
      '#empty_option' => t('No preference'),
      '#empty_value' => '',
      '#chosen' => FALSE,
    );
  }
}