You are here

function google_adwords_field_validate in Google AdWords Conversion Tracking 7

Implements hook_field_validate().

File

./google_adwords.module, line 73
Google Adwords Conversion Tracking Module

Code

function google_adwords_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors) {
  foreach ($items as $delta => $item) {
    if (!empty($item['conversion_id']) && (!is_numeric($item['conversion_id']) || (int) $item['conversion_id'] != $item['conversion_id'])) {
      $error = t('%name: The ID value has to be numeric.', array(
        '%name' => $instance['label'],
      ));
      $errors[$field['field_name']][$langcode][$delta][] = array(
        'error' => $error,
        'message' => $error,
      );
    }
  }
  return;
}