You are here

function _colorized_gmap_form_map_coordinates in Colorized google maps block 7

Helper function. Create form elements for map zoom position settings.

1 call to _colorized_gmap_form_map_coordinates()
colorized_gmap_form_alter in ./colorized_gmap.module
Implements hook_form_alter().

File

./colorized_gmap.admin.inc, line 555
Administrative page for colorized gmap module.

Code

function _colorized_gmap_form_map_coordinates(&$form, &$form_state, $entity = NULL) {
  $coords = array();
  if (isset($entity)) {
    $coords = array(
      'latitude' => $entity->latitude,
      'longitude' => $entity->longitude,
    );
  }
  $form['settings']['coordinates'] = array(
    '#type' => 'fieldset',
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#weight' => 1,
  );
  $form['settings']['coordinates']['latitude'] = array(
    '#type' => 'textfield',
    '#title' => t('Latitude'),
    '#size' => 10,
    '#weight' => 0,
    '#default_value' => !empty($coords['latitude']) ? $coords['latitude'] : '48.853358',
    '#ajax' => array(
      'callback' => 'colorized_gmap_styles_update',
      'wrapper' => 'colorized-gmap-content',
      'progress' => array(
        'type' => 'none',
      ),
    ),
  );
  $form['settings']['coordinates']['longitude'] = array(
    '#type' => 'textfield',
    '#title' => t('Longitude'),
    '#size' => 10,
    '#weight' => 2,
    '#default_value' => !empty($coords['longitude']) ? $coords['longitude'] : '2.348903',
    '#ajax' => array(
      'callback' => 'colorized_gmap_styles_update',
      'wrapper' => 'colorized-gmap-content',
      'progress' => array(
        'type' => 'none',
      ),
    ),
  );
}