You are here

function content_taxonomy_field_widget_form_alter in Content Taxonomy 7

Implements hook_field_widget_form_alter().

File

./content_taxonomy.module, line 144

Code

function content_taxonomy_field_widget_form_alter(&$element, &$form_state, $context) {
  $field = $context['field'];
  $instance = $context['instance'];
  if (!empty($instance['widget']['settings']['content_taxonomy_opt_groups'])) {
    $options = content_taxonomy_allowed_values_opt_groups($field);
    if (isset($element['#options']['_none'])) {
      $options = array(
        '_none' => $element['#options']['_none'],
      ) + $options;
    }
    $element['#options'] = $options;
  }
}