You are here

function route_planner_address_form in Route Planner 7

Same name and namespace in other branches
  1. 6 route_planner.module \route_planner_address_form()

The Address-Form.

A form to input a address and get. The driving time and distance will automatically set after clicken the button.

Return value

The address form.

1 string reference to 'route_planner_address_form'
route_planner_get_address_form in ./route_planner.module
Get Address-Form Block

File

./route_planner.module, line 111
The Route Planner module create blocks to show a route from any address to a fixed point.

Code

function route_planner_address_form($form, &$form_state) {
  $form['start'] = array(
    '#type' => 'textfield',
    '#title' => t('Address'),
    '#default_value' => '',
    '#size' => 20,
  );
  if (variable_get('route_planner_address_end', FALSE)) {
    $form['end'] = array(
      '#type' => 'textfield',
      '#title' => t('Target address'),
      '#default_value' => variable_get('route_planner_address', 'Hamburg, Germany'),
      '#size' => 20,
    );
  }
  $form['distance'] = array(
    '#type' => 'textfield',
    '#title' => t('Distance'),
    '#default_value' => '0.00',
    '#size' => 20,
    '#disabled' => TRUE,
  );
  $form['time'] = array(
    '#type' => 'textfield',
    '#title' => t('Driving time'),
    '#default_value' => '0.00',
    '#size' => 20,
    '#disabled' => TRUE,
  );
  if (variable_get('route_planner_map_travelmode', FALSE)) {
    $form['travel_mode'] = array(
      '#type' => 'radios',
      '#title' => t('Travel mode'),
      '#options' => array(
        '0' => t('Driving'),
        '1' => t('Bicycling'),
        '2' => t('Transit'),
        '3' => t('Walking'),
      ),
      '#default_value' => '0',
    );
  }
  $form['button'] = array(
    '#type' => 'button',
    '#value' => t('Calculate route'),
    '#attributes' => array(
      'onClick' => 'return Drupal.myRoutePlanner.calcRoute();',
    ),
  );
  return $form;
}