You are here

function geocoder_kml_field in Geocoder 7

Plugin callback.

1 string reference to 'geocoder_kml_field'
kml.inc in plugins/geocoder_handler/kml.inc

File

plugins/geocoder_handler/kml.inc, line 28

Code

function geocoder_kml_field($field, $field_item) {
  if ($field['type'] === 'text' || $field['type'] === 'text_long' || $field['type'] === 'computed') {
    return geocoder_kml($field_item['value']);
  }
  if ($field['type'] === 'file') {
    if ($field_item['fid']) {
      $file = file_load($field_item['fid']);
      $path = $file->uri;
      if ($file->filemime === 'application/vnd.google-earth.kmz' && extension_loaded('zip')) {
        $path = 'zip://' . drupal_realpath($path) . '#doc.kml';
      }
      $kml = file_get_contents($path);
      return geocoder_kml($kml);
    }
  }
}