You are here

function gm3_field_field_is_empty in Google Maps API V3 7

Implements hook_field_is_empty().

File

gm3_field/gm3_field.module, line 539

Code

function gm3_field_field_is_empty($item, $field) {
  switch ($field['type']) {
    case 'gm3_point':
    case 'gm3_polygon':
    case 'gm3_polyline':
    case 'gm3_rectangle':
      return !strlen(trim($item['map']));
    case 'gm3_combination':
      foreach ($item['map']['children'] as $type => $value) {
        if (is_array($value)) {
          if (count($value)) {
            return FALSE;
          }
        }
        else {
          if (is_string($value)) {
            if (strlen(trim($value))) {
              return FALSE;
            }
          }
        }
      }
      return TRUE;
  }
}