public function SearchApiViewsHandlerFieldLocation::options_form in Search API Location 7.2
Provide a options form for this handler.
Overrides entity_views_handler_field_text::options_form
File
- search_api_location_views/
handler_field_location.inc, line 37 - Contains SearchApiViewsHandlerFieldLocation.
Class
- SearchApiViewsHandlerFieldLocation
- Specialized handler for latitude/longitude fields.
Code
public function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['show_distance_to_point'] = array(
'#type' => 'checkbox',
'#title' => t('Show distance instead of coordinates'),
'#default_value' => $this->options['show_distance_to_point'],
'#description' => t('Shows the distance to the point from the filters instead of the coordinates of the result.'),
);
$form['conversion_factor'] = array(
'#type' => 'select',
'#title' => t('Distance unit'),
'#default_value' => $this->options['conversion_factor'],
'#options' => array(
t('SI') => array(
'1' => t('Kilometre'),
'0.001' => t('Metre'),
'0.0001' => t('Decimetre'),
),
t('Imperial / US') => array(
'1.60926939169617' => t('Mile'),
'0.0050301810865191' => t('Pole / rod / perch'),
'0.0009140767824497258' => t('Yard'),
'0.0003047851264858275' => t('Foot'),
),
t('Nautic') => array(
'1.853224610822832' => t('US / British nautical mile'),
'1.851851851851852' => t('International nautical mile'),
),
),
'#dependency' => array(
'edit-options-show-distance-to-point' => array(
TRUE,
),
),
);
$form['set_precision'] = array(
'#type' => 'checkbox',
'#title' => t('Round'),
'#description' => t('If checked, the number will be rounded.'),
'#default_value' => $this->options['set_precision'],
'#dependency' => array(
'edit-options-show-distance-to-point' => array(
TRUE,
),
),
);
$form['precision'] = array(
'#type' => 'textfield',
'#title' => t('Precision'),
'#default_value' => $this->options['precision'],
'#description' => t('Specify how many digits to print after the decimal point.'),
'#size' => 2,
'#maxlength' => 1,
'#dependency' => array(
'edit-options-set-precision' => array(
TRUE,
),
),
);
$form['decimal'] = array(
'#type' => 'textfield',
'#title' => t('Decimal point'),
'#default_value' => $this->options['decimal'],
'#description' => t('What single character to use as a decimal point.'),
'#size' => 2,
'#maxlength' => 1,
'#dependency' => array(
'edit-options-show-distance-to-point' => array(
TRUE,
),
),
);
$form['separator'] = array(
'#type' => 'textfield',
'#title' => t('Thousands marker'),
'#default_value' => $this->options['separator'],
'#description' => t('What single character to use as the thousands separator.'),
'#size' => 2,
'#maxlength' => 1,
'#dependency' => array(
'edit-options-show-distance-to-point' => array(
TRUE,
),
),
);
}