You are here

public function geofield_handler_argument_proximity::getDefaultDist in Geofield 7.2

2 calls to geofield_handler_argument_proximity::getDefaultDist()
geofield_handler_argument_proximity::parseAddress in views/handlers/geofield_handler_argument_proximity.inc
Interpret URL args as an address with optional distance attached.
geofield_handler_argument_proximity::parseLatLonDistArg in views/handlers/geofield_handler_argument_proximity.inc
Extract lat,lon and distance from arg and return as array.

File

views/handlers/geofield_handler_argument_proximity.inc, line 207
Geofield contextual filter argument handler for Views.

Class

geofield_handler_argument_proximity
The proximity argument may be appended to URL in the following format: /lat,lon_dist where dist is a positive number representing a circular proximity in either kilometers or miles, as configured through the contextual filter UI.

Code

public function getDefaultDist() {
  if (!empty($this->options['proximity']['default_radius'])) {
    return $this->options['proximity']['default_radius'];
  }
  $defaults = $this
    ->getDefaultLatLonDist();
  if (empty($defaults) || count($defaults) == 2) {

    // expecting either 1 or 3 numbers
    return 100;

    // last resort default, same as geofield_handler_filter.inc
  }
  return isset($defaults[2]) ? $defaults[2] : reset($defaults);
}