You are here

function telephone_field_widget_form in Telephone 7

Implements hook_field_widget_form().

File

./telephone.module, line 75
Defines a simple telephone number field type.

Code

function telephone_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $widget = $instance['widget'];
  $settings = $widget['settings'];
  $element += array(
    '#type' => module_exists('elements') ? 'telfield' : 'textfield',
    '#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : '',
    '#placeholder' => $settings['placeholder'],
  );
  return array(
    'value' => $element,
  );
}