function chosen_field_widget_settings_form in Chosen 7.3
Same name and namespace in other branches
- 6 chosen.module \chosen_field_widget_settings_form()
- 7 chosen.module \chosen_field_widget_settings_form()
Implementation of chosen_field_widget_settings_form().
Provides the form array for the field configuration.
Parameters
$instance: Field instance definition provided by field_info_instance().
Return value
$form A renderable form array containing the chosen plugin options.
1 call to chosen_field_widget_settings_form()
- chosen_form_field_ui_field_edit_form_alter in ./
chosen.module - Implements hook_form_FORM_ID_alter().
File
- ./
chosen.module, line 160 - General functions and hook implementations.
Code
function chosen_field_widget_settings_form($instance) {
$widget = $instance['widget'];
$settings = $widget['settings'];
$form['chosen'] = array(
'#type' => 'fieldset',
'#title' => t('Chosen'),
'#collapsed' => TRUE,
'#collapsible' => TRUE,
'#parents' => array(
'instance',
'widget',
'settings',
),
);
$form['chosen']['apply_chosen'] = array(
'#type' => 'checkbox',
'#title' => t('Apply Chosen on this field'),
'#default_value' => isset($settings['apply_chosen']) ? $settings['apply_chosen'] : FALSE,
);
$form['chosen']['override'] = array(
'#type' => 'checkbox',
'#title' => t('Override chosen default settings'),
'#default_value' => isset($settings['override']) ? $settings['override'] : FALSE,
);
$form['chosen']['chosen_wrapper'] = array(
'#type' => 'fieldset',
'#title' => t('Chosen settings'),
'#collapsed' => TRUE,
'#collapsible' => TRUE,
'#weight' => 20,
'#states' => array(
'visible' => array(
':input[name="instance[widget][settings][override]"]' => array(
'checked' => TRUE,
),
),
),
);
$default_values = _chosen_flattern_default_values($instance['chosen_wrapper']);
$default_values = _chosen_devide_array_by_plugin($default_values);
$settings_form = chosen_generate_forms($default_values);
$form['chosen']['chosen_wrapper'] += $settings_form;
return $form;
}