function bigint_field_widget_form in Big Integer 7
Implements hook_field_widget_form().
File
- ./
bigint.module, line 266 - Defines numeric field types.
Code
function bigint_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$value = isset($items[$delta]['value']) ? $items[$delta]['value'] : '';
$element += array(
'#type' => 'textfield',
'#default_value' => $value,
'#size' => $instance['settings']['size'],
'#number_type' => str_replace('number_', '', $field['type']),
);
// Add prefix and suffix.
if (!empty($instance['settings']['prefix'])) {
$prefixes = explode('|', $instance['settings']['prefix']);
$element['#field_prefix'] = field_filter_xss(array_pop($prefixes));
}
if (!empty($instance['settings']['suffix'])) {
$suffixes = explode('|', $instance['settings']['suffix']);
$element['#field_suffix'] = field_filter_xss(array_pop($suffixes));
}
$element['#element_validate'][] = 'bigint_field_widget_validate';
return array(
'value' => $element,
);
}