function locationmap_page in Location Map 8.2
Same name and namespace in other branches
- 7.2 locationmap.module \locationmap_page()
- 7 locationmap.module \locationmap_page()
Menu callback; generate a page with the location map.
1 string reference to 'locationmap_page'
- locationmap_menu in ./
locationmap.module - Implements hook_menu().
File
- ./
locationmap.module, line 69
Code
function locationmap_page() {
$config = config('locationmap.settings');
$defaults = array(
'value' => '',
'format' => filter_default_format(),
);
$locationmap_info_defaults = array(
'value' => 'Fiordland, New Zealand',
'format' => filter_default_format(),
);
$path = drupal_get_path('module', 'locationmap');
drupal_add_js('//maps.google.com/maps/api/js?v=3&sensor=false', array(
'type' => 'external',
'weight' => 5,
));
drupal_add_js($path . '/locationmap.js', array(
'type' => 'file',
'weight' => 6,
'scope' => 'footer',
));
$locationmap_css_options = array(
'preprocess' => FALSE,
);
drupal_add_css($path . '/locationmap.css', $locationmap_css_options);
$locationmap_settings = array(
'address' => $config
->get('address'),
'info' => $config
->get('info.value'),
'lat' => $config
->get('latitude'),
'lng' => $config
->get('longitude'),
'zoom' => $config
->get('zoom'),
'type' => $config
->get('type'),
'admin' => user_access('administer locationmap'),
);
if (!$locationmap_settings['info']) {
$locationmap_settings['info'] = $locationmap_settings['address'];
}
drupal_add_js(array(
'locationmap' => $locationmap_settings,
), 'setting');
$output = '<div id="locationmap_body">' . $config
->get('body.value') . '</div>';
$output .= theme('locationmap_map');
$output .= '<div id="locationmap_footer">' . $config
->get('footer.value') . '</div>';
if (user_access('administer locationmap')) {
// TODO: Remove drupal_render and update to D7 desired behaviour. See http://drupal.org/update/modules/6/7#unrendered
$form = drupal_get_form('locationmap_in_place_edit_form');
$output .= drupal_render($form);
}
drupal_set_title($config
->get('title'));
return $output;
}