function _options_element_add_allowed_values_element in Options Element 7
Add options_element widget to form.
2 calls to _options_element_add_allowed_values_element()
File
- ./
options_element.module, line 275 - Defines an "options" form element type for entering select list options.
Code
function _options_element_add_allowed_values_element(&$form, $element) {
$default_element = array(
'#type' => 'options',
'#key_type' => 'mixed',
// Optimal for now.
'#key_type_toggle' => t('Custom keys'),
'#key_type_toggled' => TRUE,
'#after_build' => array(
'options_element_field_settings_after_build',
),
'#access' => $form['field']['settings']['allowed_values']['#access'],
'#default_value' => '',
// Pass original data for validating.
'#original' => array(
'#title' => $form['field']['settings']['allowed_values']['#title'],
'#field_has_data' => $form['field']['settings']['allowed_values']['#field_has_data'],
'#field' => $form['field']['settings']['allowed_values']['#field'],
'#field_type' => $form['field']['settings']['allowed_values']['#field_type'],
),
);
$element = drupal_array_merge_deep($default_element, $element);
$form['field']['settings']['allowed_values'] = $element;
// Set proper allowed values in $form_state.
$form['#validate'][] = 'options_element_field_settings_validate';
}