function international_phone_field_widget_form in International Phone Field 7
Same name and namespace in other branches
- 7.2 international_phone.module \international_phone_field_widget_form()
Implements hook_field_widget_form().
File
- ./
international_phone.module, line 83 - Allow users to add international phone fields with a entity.
Code
function international_phone_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
drupal_add_css(drupal_get_path('module', 'international_phone') . '/css/intlTelInput.css');
$element['value'] = array(
'#type' => 'textfield',
'#title' => check_plain($element['#title']),
'#description' => check_plain($element['#description']),
'#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : '',
'#required' => $element['#required'],
'#size' => 17,
'#attributes' => array(
'class' => array(
'international_phone-number',
),
),
);
drupal_add_js('http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', 'external');
drupal_add_js(drupal_get_path('module', 'international_phone') . '/js/intlTelInput.js');
drupal_add_js(drupal_get_path('module', 'international_phone') . '/js/international_phone.js');
return $element;
}