You are here

function chosen_field_widget_form_alter in Chosen 6

Same name and namespace in other branches
  1. 8.2 chosen.module \chosen_field_widget_form_alter()
  2. 7.3 chosen.module \chosen_field_widget_form_alter()
  3. 7 chosen.module \chosen_field_widget_form_alter()
  4. 7.2 chosen.module \chosen_field_widget_form_alter()
  5. 3.0.x chosen.module \chosen_field_widget_form_alter()

Implements hook_field_widget_form_alter().

File

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

Code

function chosen_field_widget_form_alter(&$element, &$form_state, $context) {
  $type = $context['instance']['widget']['type'];
  if ($type == CHOSEN_WIDGET) {
    $settings = $context['instance']['widget']['settings'];
    if ($settings['apply_chosen']) {
      $element['#attributes']['class'][] = 'chosen-widget';
    }
  }
}