You are here

function geofield_validate_geom in Geofield 7.2

Validates input data against the geometry processor

Parameters

array $item: Geometry field submission

Return value

\Exception|null If validates, return NULL, else error text

1 call to geofield_validate_geom()
geofield_field_validate in ./geofield.module
Implements hook_field_validate().

File

./geofield.module, line 206

Code

function geofield_validate_geom($item) {
  if (is_string($item)) {
    try {
      $values = geofield_compute_values($item);
    } catch (Exception $e) {
      return $e;
    }
  }
  else {
    try {
      $input_format = !empty($item['input_format']) ? $item['input_format'] : NULL;
      $values = geofield_compute_values($item['geom'], $input_format);
    } catch (Exception $e) {
      return $e;
    }
  }
  return NULL;
}