You are here

function theme_getlocations_mapquest_settings_form in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_mapquest/getlocations_mapquest.module \theme_getlocations_mapquest_settings_form()

Function

Return value

Returns

File

modules/getlocations_mapquest/getlocations_mapquest.module, line 2155
getlocations_mapquest.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function theme_getlocations_mapquest_settings_form($variables) {
  $form = $variables['form'];
  $output = '';
  $form['getlocations_mapquest_defaults']['returnlink_page_link']['#prefix'] = '<div id="wrap-page-link">';
  $form['getlocations_mapquest_defaults']['returnlink_page_link']['#suffix'] = '</div>';
  if (isset($form['getlocations_mapquest_defaults']['returnlink_user_link'])) {
    $form['getlocations_mapquest_defaults']['returnlink_user_link']['#prefix'] = '<div id="wrap-user-link">';
    $form['getlocations_mapquest_defaults']['returnlink_user_link']['#suffix'] = '</div>';
  }
  if (isset($form['getlocations_mapquest_defaults']['returnlink_term_link'])) {
    $form['getlocations_mapquest_defaults']['returnlink_term_link']['#prefix'] = '<div id="wrap-term-link">';
    $form['getlocations_mapquest_defaults']['returnlink_term_link']['#suffix'] = '</div>';
  }
  if (isset($form['getlocations_mapquest_defaults']['returnlink_comment_link'])) {
    $form['getlocations_mapquest_defaults']['returnlink_comment_link']['#prefix'] = '<div id="wrap-comment-link">';
    $form['getlocations_mapquest_defaults']['returnlink_comment_link']['#suffix'] = '</div>';
  }

  // preview mapquest
  if (isset($form['getlocations_mapquest_preview']['preview_map']['#markup'])) {
    $links = array();
    $nodezoom = FALSE;
    $iconlist = array();
    $getlocations_mapquest_defaults = getlocations_mapquest_defaults();
    $ll = explode(',', $getlocations_mapquest_defaults['latlong']);
    $map_settings['map_opts']['center'] = array(
      $ll[0],
      $ll[1],
    );
    $map_settings['map_opts']['zoom'] = $getlocations_mapquest_defaults['zoom'];
    $mapid = getlocations_setup_map('', FALSE, FALSE, TRUE);
    $latlons = array();
    $minmaxes = array();
    $map_settings['map_settings']['dragging'] = TRUE;

    // add in some more
    $map_settings = getlocations_mapquest_map_settings_do($map_settings, $getlocations_mapquest_defaults, $latlons, $mapid);
    $map_settings['map_settings']['nodezoom'] = $nodezoom ? $nodezoom : FALSE;
    $map_settings['map_settings']['minmaxes'] = empty($minmaxes) ? FALSE : implode(',', $minmaxes);
    $map_settings['icons'] = $iconlist;
    $map_settings['datanum'] = 0;
    $map_settings['latlons'] = $latlons;
    $map_settings['extcontrol'] = 'preview_map';
    $preview_map = theme('getlocations_mapquest_map', array(
      'width' => $getlocations_mapquest_defaults['width'],
      'height' => $getlocations_mapquest_defaults['height'],
      'map_settings' => $map_settings,
      'mapid' => $mapid,
      'links' => $links,
    ));
    $form['getlocations_mapquest_preview']['preview_map']['#markup'] = '<div id="getlocations_mapquest_preview_map">' . $preview_map . '</div>';
  }
  $output .= drupal_render_children($form);
  return $output;
}