You are here

function theme_gmap_views_view_gmapextended in GMap Module 7

Same name and namespace in other branches
  1. 7.2 gmap.views.inc \theme_gmap_views_view_gmapextended()

@file GMap Views support.

File

./gmap.views.inc, line 8
GMap Views support.

Code

function theme_gmap_views_view_gmapextended(&$vars) {
  $markers = array();
  foreach ($vars['markers'] as $offset => $data) {
    if (empty($data['latitude']) || empty($data['longitude'])) {
      continue;
    }
    $markers[] = $data;
  }

  // @@@ Move to preprocess
  $map = gmap_parse_macro($vars['options']['macro']);

  // If center lon/lat are not empty they are used to center map
  if (!empty($vars['center']['longitude']) && !empty($vars['center']['latitude'])) {
    $map['longitude'] = $vars['center']['longitude'];
    $map['latitude'] = $vars['center']['latitude'];
  }
  if (!empty($vars['options']['iwq'])) {
    $map['iwq'] = $vars['options']['iwq'];
  }
  $map['markers'] = $markers;
  $elem = array(
    '#type' => 'gmap',
    '#gmap_settings' => $map,
  );
  return drupal_render($elem);
}