function geofield_handler_argument_proximity::options_form in Geofield 7.2
Add form elements to select options for this contextual filter.
Overrides views_handler_argument::options_form
File
- views/
handlers/ geofield_handler_argument_proximity.inc, line 28 - 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
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['proximity'] = array(
'#type' => 'fieldset',
'#title' => t('Filter locations by proximity to a reference point'),
'#description' => t('The reference point is normally apppend to the URL as lat,lon, or if you have the !geocoder module enabled, as a partial address, like "/New York"', array(
'!geocoder' => l('Geocoder', 'http://drupal.org/project/geocoder'),
)),
);
$form['proximity']['operation'] = array(
'#type' => 'select',
'#title' => t('Select locations'),
'#options' => array(
'lt' => t('Inside radius'),
'gt' => t('Outside radius'),
),
'#default_value' => $this->options['proximity']['operation'],
'#description' => t("Reference point coordinates (<strong>lat,lon</strong>) and <strong>distance</strong> are typically appended to the URL. A fallback may be entered above under <em>Provide default value</em> as either a <em>Fixed value</em> or as <em>PHP Code</em>. <br/>In all cases use this format: <strong>lat,lon distance</strong>. You may omit either <strong>lat,lon</strong> or <strong>distance</strong>. Instead of spaces and comma's, you can use underscores."),
);
$form['proximity']['default_radius'] = array(
'#type' => 'textfield',
'#title' => t('Default radius'),
'#size' => 8,
'#default_value' => $this->options['proximity']['default_radius'],
'#description' => t("Used if no distance is specified. If left blank <em>Fixed value</em> or <em>PHP Code</em> will be used instead."),
);
$form['proximity']['radius_unit'] = array(
'#type' => 'select',
'#title' => t('Unit of distance'),
'#options' => geofield_radius_options(),
'#default_value' => $this->options['proximity']['radius_unit'],
'#description' => t('Select the unit of distance.'),
);
}