function vat_number_field_widget_form in VAT Number 7
Implements hook_field_widget_form().
File
- ./
vat_number.module, line 94 - Define a VAT Number field for use on Drupal Commerce Customer Profiles.
Code
function vat_number_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$value = isset($items[$delta]['value']) ? $items[$delta]['value'] : '';
$base = $element;
switch ($instance['widget']['type']) {
case 'vat_number_widget':
$element['value'] = array(
'#type' => 'textfield',
'#default_value' => $value,
'#size' => 20,
'#maxlength' => 255,
'#element_validate' => array(
'vat_number_field_widget_element_validate',
),
) + $base;
break;
}
return $element;
}