You are here

function locationmap_block_image in Location Map 8.2

Same name and namespace in other branches
  1. 7.2 locationmap.module \locationmap_block_image()
  2. 7 locationmap.module \locationmap_block_image()

@todo Please document this function.

See also

http://drupal.org/node/1354

1 call to locationmap_block_image()
locationmap_block_view in ./locationmap.module
Implements hook_block_view().

File

./locationmap.module, line 312

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');
    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_settings = array(
      'address' => variable_get('locationmap_address', 'Fiordland, New Zealand'),
      'info' => variable_get('locationmap_info', 'Fiordland, New Zealand'),
      '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'),
    );
    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;
}