You are here

function wysiwyg_map_tokenbuilder_form in WYSIWYG Map 7

Form builder for the google map field token builder.

1 string reference to 'wysiwyg_map_tokenbuilder_form'
wysiwyg_map_menu in ./wysiwyg_map.module
Implements hook_menu().

File

./wysiwyg_map.module, line 54
wysiwyg_map.module

Code

function wysiwyg_map_tokenbuilder_form($form, &$form_state) {
  drupal_set_title(t('WYSIWYG Map Token Builder'));
  $form = array();
  $form['token_builder']['map'] = array(
    '#markup' => theme('wysiwyg_map_selector'),
    '#prefix' => '<div class="wysiwyg-map-tokenbuilder"><div class="wysiwyg-map-tokenbuilder-map">',
  );
  $form['token_builder']['token'] = array(
    '#type' => 'hidden',
    '#attributes' => array(
      'id' => 'edit-token',
    ),
    '#default_value' => 'lat=51.0,lon=0.12,width=300,height=250,zoom=9,map_type=roadmap',
  );
  $form['token_builder']['center_on'] = array(
    '#type' => 'textfield',
    '#title' => t('Center On'),
    '#description' => t('To center the map on a location, please enter the location in the box above, e.g. "London, UK" or "1 Southwark Street, London, UK" and click \'Center map\''),
    '#size' => 40,
    '#attributes' => array(
      'onkeyup' => 'return wysiwyg_map_buildToken();',
    ),
  );
  $form['token_builder']['do_center'] = array(
    '#type' => 'button',
    '#value' => t('Center map'),
    '#attributes' => array(
      'onclick' => 'return wysiwyg_map_doCenterPopup();',
    ),
    '#suffix' => '</div>',
  );
  $form['token_builder']['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#description' => 'Maximum: 600, minimum: 100.',
    '#size' => 15,
    '#default_value' => '300',
    '#attributes' => array(
      'onkeyup' => 'return wysiwyg_map_buildToken();',
    ),
    '#prefix' => '<div class="wysiwyg-map-tokenbuilder-fields-1">',
  );
  $form['token_builder']['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#description' => 'Maximum: 600, minimum: 100.',
    '#size' => 15,
    '#default_value' => '250',
    '#attributes' => array(
      'onkeyup' => 'return wysiwyg_map_buildToken();',
    ),
  );
  $form['token_builder']['css_class'] = array(
    '#type' => 'textfield',
    '#title' => t('CSS Class'),
    '#description' => 'To align the map left, right or center, please use the following classes: pull-left, pull-right, pull-center.',
    '#size' => 15,
    '#default_value' => '',
    '#attributes' => array(
      'onkeyup' => 'return wysiwyg_map_buildToken();',
    ),
  );
  $form['token_builder']['map_caption'] = array(
    '#type' => 'textfield',
    '#title' => t('Map caption'),
    '#description' => 'This is displayed below the map, as a description. If left empty, it will not display.',
    '#size' => 94,
    '#default_value' => '',
    '#attributes' => array(
      'onkeyup' => 'return wysiwyg_map_buildToken();',
    ),
  );
  $form['token_builder']['marker_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Marker title'),
    '#description' => 'This displays in a tooltip text when hovering the marker. If left empty, it will not display.',
    '#size' => 94,
    '#default_value' => '',
    '#attributes' => array(
      'onkeyup' => 'return wysiwyg_map_buildToken();',
    ),
    '#suffix' => '</div>',
  );
  $form['token_builder']['marker_popup_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Popup title'),
    '#description' => 'Text displayed as title when clicking the marker. If both the popup title and popup text are left empty, no popup will display.',
    '#size' => 94,
    '#default_value' => '',
    '#attributes' => array(
      'onkeyup' => 'return wysiwyg_map_buildToken();',
    ),
    '#prefix' => '<div class="wysiwyg-map-tokenbuilder-fields-2">',
  );
  $form['token_builder']['marker_popup_text'] = array(
    '#type' => 'textarea',
    '#title' => t('Popup text'),
    '#description' => 'Text displayed below the title when clicking the marker. If both the popup title and popup text are left empty, no popup will display.',
    '#size' => 15,
    '#default_value' => '',
    '#attributes' => array(
      'onkeyup' => 'return wysiwyg_map_buildToken();',
    ),
  );
  $form['token_builder']['marker_popup_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display the popup on page load'),
    '#description' => 'You can choose to display the popup by default or not.',
    '#size' => 15,
    '#attributes' => array(
      'onchange' => 'return wysiwyg_map_buildToken();',
    ),
    '#suffix' => '</div>',
  );
  $form['token_builder']['map_type'] = array(
    '#type' => 'hidden',
    '#attributes' => array(
      'id' => 'edit-map-type',
    ),
    '#default_value' => 'roadmap',
  );
  $form['token_builder']['zoom'] = array(
    '#type' => 'hidden',
    '#default_value' => '9',
    '#attributes' => array(
      'id' => 'edit-zoom',
    ),
    '#suffix' => '</div></div>',
  );
  return $form;
}