function locationmap_block_image in Location Map 7.2
Same name and namespace in other branches
- 8.2 locationmap.module \locationmap_block_image()
- 7 locationmap.module \locationmap_block_image()
@todo Please document this function.
See also
1 call to locationmap_block_image()
- locationmap_block_view in ./
locationmap.module - Implements hook_block_view().
File
- ./
locationmap.module, line 515
Code
function locationmap_block_image() {
$type = variable_get('locationmap_block_type', 'image');
$block = array();
$block['subject'] = variable_get('locationmap_title', t('Our Location'));
if ($type == 'interactive') {
$width = variable_get('locationmap_block_mapwidth', 160);
$height = variable_get('locationmap_block_mapheight', 120);
$path = drupal_get_path('module', 'locationmap');
$locationmap_info_defaults = array(
'value' => 'Fiordland, New Zealand',
'format' => filter_default_format(),
);
$locationmap_info = variable_get('locationmap_info', $locationmap_info_defaults);
$locationmap_api_key = variable_get('locationmap_api_key', '');
if ($locationmap_api_key) {
drupal_add_js('//maps.google.com/maps/api/js?v=3&key=' . $locationmap_api_key, array(
'type' => 'external',
'weight' => 5,
));
}
else {
drupal_add_js('//maps.google.com/maps/api/js?v=3', array(
'type' => 'external',
'weight' => 5,
));
if (user_access('administer locationmap')) {
$msg = l(t('Location Map Configuration Page'), 'admin/config/content/locationmap');
$google_map_key_msg = l(t('Google API Console'), 'https://developers.google.com/maps/documentation/javascript/get-api-key');
drupal_set_message(t("Please set Google Map API Key at {$msg}. You can get Google Map API key from {$google_map_key_msg}"), 'warning', FALSE);
}
}
drupal_add_js($path . '/locationmap.js', array(
'type' => 'file',
'weight' => 6,
'scope' => 'footer',
));
drupal_add_css($path . '/locationmap.css');
$locationmap_settings = array(
'address' => variable_get('locationmap_address', 'Fiordland, New Zealand'),
'info' => $locationmap_info['value'],
'popinfo' => variable_get('locationmap_popinfo', false),
'lat' => variable_get('locationmap_lat', '-46.0868686'),
'lng' => variable_get('locationmap_lng', '166.6822074'),
'zoom' => variable_get('locationmap_zoom', 10),
'type' => variable_get('locationmap_type', 'G_NORMAL_MAP'),
'admin' => user_access('administer locationmap'),
'scroll' => variable_get('locationmap_scroll', 1),
);
if (!$locationmap_settings['info']) {
$locationmap_settings['info'] = $locationmap_settings['address'];
}
drupal_add_js(array(
'locationmap' => $locationmap_settings,
), 'setting');
$block['content'] = theme('locationmap_map', array(
'width' => $width,
'height' => $height,
));
}
else {
$block['content'] = theme('locationmap_block_image_link');
}
return $block;
}