You are here

function _ip_geoloc_set_my_location_add_find_me in IP Geolocation Views & Maps 7

1 call to _ip_geoloc_set_my_location_add_find_me()
ip_geoloc_set_location_form in ./ip_geoloc_blocks.inc
Form for finding the visitor or going to a region or street address.

File

./ip_geoloc_blocks.inc, line 513
Blocks available in IP Geolocation Views & Maps.

Code

function _ip_geoloc_set_my_location_add_find_me(&$form, $ajax_wrapper_id) {
  $find_visitor_label = variable_get('ip_geoloc_visitor_find_label', '');
  $find_visitor_label = empty($find_visitor_label) ? IP_GEOLOC_VISITOR_DEFAULT_FIND_LABEL : filter_xss_admin($find_visitor_label);

  // See _ip_geoloc_process_find_me_ajax() for why this is done here.
  if (variable_get('ip_geoloc_visitor_reverse_geocode')) {
    $form['#attached']['js'][] = IP_GEOLOC_GOOGLE_MAPS;
  }
  $form['find'] = array(
    // Use 'submit' to go with '#submit'. For #ajax 'button' may be used too.
    '#type' => 'button',
    '#value' => $find_visitor_label,
    '#submit' => array(
      '_ip_geoloc_process_find_me_submit',
    ),
    '#ajax' => array(
      'callback' => '_ip_geoloc_process_find_me_ajax',
      'wrapper' => $ajax_wrapper_id,
      'progress' => FALSE,
    ),
    '#weight' => variable_get('ip_geoloc_visitor_find_position', 0),
  );
  $throbber_text = variable_get('ip_geoloc_throbber_text', '');
  if (empty($throbber_text)) {
    $throbber_text = IP_GEOLOC_THROBBER_DEFAULT_TEXT;
  }
  if ($throbber_text != '<none>') {
    $form['find']['#ajax']['progress'] = array(
      'type' => 'throbber',
      'message' => filter_xss_admin($throbber_text),
    );
  }
}