You are here

function phone_field_presave in Phone 7.2

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

Implements hook_field_presave().

File

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

Code

function phone_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {

  // Load libphonenumber.
  phone_libphonenumber();
  foreach ($items as $delta => $item) {
    $extension = isset($item['extension']) ? trim($item['extension']) : '';
    $items[$delta] = phone_libphonenumber_clean(trim($item['number']), $item['countrycode'], $extension) + $items[$delta];
  }
}