You are here

function phone_field_widget_form in Phone 7.2

Same name and namespace in other branches
  1. 7 phone.module \phone_field_widget_form()

Implements hook_field_widget_form().

File

./phone.module, line 935
The phone module lets administrators use a phone number field type.

Code

function phone_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $entitytype = $element['#entity_type'];
  $entity = $element['#entity'];
  $allowed_values = phone_numbertype_allowed_values($field, $instance);
  $element += array(
    '#type' => 'phone',
    '#title' => $element['#title'],
    '#description' => $element['#description'],
    '#default_value' => isset($items[$delta]) ? $items[$delta] : array(),
    '#required' => $element['#required'],
    '#phone_settings' => array_merge($field['settings'], array(
      'numbertype_allowed_values' => $allowed_values,
    ), $instance['settings'], $instance['widget']['settings'], array(
      'bubble_errors' => TRUE,
    )),
  );
  return $element;
}