You are here

function phone_field_presave in Phone 7

Same name and namespace in other branches
  1. 7.2 phone.module \phone_field_presave()

Implements hook_field_presave().

File

./phone.module, line 171

Code

function phone_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
  $ccode = $field['settings']['country'];
  if (phone_countries($ccode) !== NULL) {
    foreach ($items as $delta => $item) {
      if (isset($item['value'])) {
        $items[$delta]['value'] = format_phone_number($ccode, $item['value'], $instance['settings']);
      }
    }
  }
}