You are here

public function geofieldProximityOtherGeofield::getSourceValue in Geofield 7.2

Overrides geofieldProximityBase::getSourceValue

File

views/proximity_plugins/geofieldProximityOtherGeofield.inc, line 44
Contains geofieldProximityOtherGeofield.

Class

geofieldProximityOtherGeofield
@file Contains geofieldProximityOtherGeofield.

Code

public function getSourceValue($views_plugin) {
  if (!empty($views_plugin->options['geofield_proximity_other_geofield'])) {
    $other_geofield = $views_plugin->view->display_handler
      ->get_handler('field', $views_plugin->options['geofield_proximity_other_geofield']);
    $views_plugin->query
      ->add_field($other_geofield->table, $other_geofield->definition['field_name'] . '_lat');
    $views_plugin->query
      ->add_field($other_geofield->table, $other_geofield->definition['field_name'] . '_lon');

    // @TODO: Not sure if we need 2nd add field.
    return array(
      'latitude' => $other_geofield->table . '.' . $other_geofield->definition['field_name'] . '_lat',
      'longitude' => $other_geofield->table . '.' . $other_geofield->definition['field_name'] . '_lon',
    );
  }
  return FALSE;
}