public function RoutePlannerAddressForm::buildForm in Route Planner 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ RoutePlannerAddressForm.php, line 34
Class
- RoutePlannerAddressForm
- The Address-Form.
Namespace
Drupal\route_planner\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['start'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Address'),
'#default_value' => '',
'#size' => 20,
);
if (\Drupal::config('route_planner.settings')
->get('route_planner_address_end')) {
$form['end'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Target address'),
'#default_value' => \Drupal::config('route_planner.settings')
->get('route_planner_address'),
'#size' => 20,
);
}
$form['distance'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Distance'),
'#default_value' => '0.00',
'#size' => 20,
'#disabled' => TRUE,
);
$form['time'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Driving time'),
'#default_value' => '0.00',
'#size' => 20,
'#disabled' => TRUE,
);
$form['button'] = array(
'#type' => 'button',
'#value' => $this
->t('Calculate route'),
'#attributes' => array(
'onClick' => 'return false;',
),
);
return $form;
}