function phonefield_field_presave in Phone Field 7
Implements hook_field_presave().
File
- ./
phonefield.module, line 33 - Hooks for a module that defines a simple phone number field type.
Code
function phonefield_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
foreach ($items as $key => $item) {
if (isset($item['linklabel'])) {
$linklabel = trim($item['linklabel']);
$items[$key]['linklabel'] = empty($linklabel) ? NULL : $linklabel;
}
else {
$items[$key]['linklabel'] = NULL;
}
$items[$key]['phonenumber'] = trim($item['phonenumber']);
$items[$key]['normalized'] = phonefield_normalize($item['phonenumber'], FALSE);
}
}