function phone_field_validate in Phone 7.2
Same name and namespace in other branches
- 7 phone.module \phone_field_validate()
Implements hook_field_validate().
File
- ./
phone.module, line 409 - The phone module lets administrators use a phone number field type.
Code
function phone_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
foreach ($items as $delta => $item) {
if (isset($item['error']) && !empty($item['error'])) {
// Message has already been processed by libphonenumber.
$errors[$field['field_name']][$langcode][$delta][] = array(
'error' => 'phone_invalid',
'message' => t('%label: !error', array(
'%label' => $instance['label'],
'!error' => $item['error'],
)),
);
}
}
}