You are here

function formatted_number_field in Formatted Number 6

Implementation of hook_field().

File

./formatted_number.module, line 369
Defines CCK numeric types where thousands separator and decimal point are inherited from the Format Number API module.

Code

function formatted_number_field($op, &$node, $field, &$items, $teaser, $page) {
  if ($op == 'validate') {
    if (is_array($items)) {
      foreach ($items as $delta => $item) {
        $error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
        if (is_array($item) && isset($item['_error_element'])) {
          unset($item['_error_element']);
        }
        $errors = formatted_number_validate_field_value($field, $item['value']);
        if (!empty($errors)) {
          foreach ($errors as $message) {
            form_set_error($error_element, $message);
          }
        }
      }
    }
  }
}