function autocomplete_deluxe_after_build in Autocomplete Deluxe 7
Same name and namespace in other branches
- 7.2 autocomplete_deluxe.module \autocomplete_deluxe_after_build()
FAPI after build callback for the duration parameter type form. Fixes up the form value by applying the multiplier.
1 string reference to 'autocomplete_deluxe_after_build'
- autocomplete_deluxe_element_process in ./
autocomplete_deluxe.module - Generates the basic form elements and javascript settings.
File
- ./
autocomplete_deluxe.module, line 345 - Define enhanced autocomplete wdiget.
Code
function autocomplete_deluxe_after_build($element, &$form_state) {
// By default drupal sets the maxlength to 128 if the property isn't
// specified, but since the limit isn't usefull in some cases,
// we unset the property.
unset($element['textfield']['#maxlength']);
if (!isset($element['list_value'])) {
$element['#value'] = isset($element['value_field']) ? $element['value_field']['#value'] : $element['textfield']['#value'];
// Do the same for similar reasons as before.
unset($element['value_field']['#maxlength']);
}
else {
if (!empty($form_state['autocomplete_deluxe']['terms']) && !empty($element['#multiple'])) {
$element['#value'] = !empty($element['list_value']['#value']) ? implode(',', $element['list_value']['#value']) : "";
}
else {
$element['#value'] = $element['list_value']['#value'];
}
}
form_set_value($element, $element['#value'], $form_state);
return $element;
}