public function ProximityFormField::viewsForm in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 src/Plugin/views/field/ProximityFormField.php \Drupal\geolocation\Plugin\views\field\ProximityFormField::viewsForm()
Provide a more useful title to improve the accessibility.
File
- src/
Plugin/ views/ field/ ProximityFormField.php, line 93
Class
- ProximityFormField
- Field handler for geolocation field.
Namespace
Drupal\geolocation\Plugin\views\fieldCode
public function viewsForm(&$form, FormStateInterface $form_state) {
$form['#tree'] = TRUE;
$form['center'] = $this->locationInputManager
->getForm($this->options['center'], $this, $this
->getCenter());
$form['actions']['submit']['#value'] = $this
->t('Calculate proximity');
// #weight will be stripped from 'output' in preRender callback.
// Offset negatively to compensate.
foreach (Element::children($form) as $key) {
if (isset($form[$key]['#weight'])) {
$form[$key]['#weight'] = $form[$key]['#weight'] - 2;
}
else {
$form[$key]['#weight'] = -2;
}
}
$form['actions']['#weight'] = -1;
}