function ip_geoloc_ip_lookup_form in IP Geolocation Views & Maps 7
Generates a simple form for collecting the IP address to be reverse-geocoded.
1 string reference to 'ip_geoloc_ip_lookup_form'
- ip_geoloc_block_view in ./
ip_geoloc_blocks.inc - Implements hook_block_view().
File
- ./
ip_geoloc_blocks.inc, line 902 - Blocks available in IP Geolocation Views & Maps.
Code
function ip_geoloc_ip_lookup_form($form, &$form_state) {
$last_visit = isset($form_state['storage']['last_visit']) ? $form_state['storage']['last_visit'] : '';
$formatted_address = isset($form_state['storage']['formatted_address']) ? $form_state['storage']['formatted_address'] : '';
if (!empty($last_visit) || !empty($formatted_address)) {
$prefix = '<div class="ip_geoloc_address_lookup">' . $formatted_address . (empty($last_visit) ? '' : "<br/>{$last_visit}") . '</div>';
}
$form['ip_address'] = array(
'#type' => 'textfield',
'#title' => t('IP address'),
'#default_value' => '',
'#size' => 16,
'#required' => FALSE,
'#prefix' => isset($prefix) ? $prefix : NULL,
);
if (user_access('administer site configuration') && variable_get('ip_geoloc_store_addresses', TRUE)) {
$form['store'] = array(
'#type' => 'checkbox',
'#title' => t('If found, store on IP geolocation database for future reference.'),
'#default_value' => FALSE,
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Lookup'),
'#submit' => array(
'ip_geoloc_ip_lookup_submit',
),
);
return $form;
}