Index: gmap_plugin_style_gmap.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap_plugin_style_gmap.inc,v retrieving revision 1.9 diff -u -p -r1.9 gmap_plugin_style_gmap.inc --- gmap_plugin_style_gmap.inc 3 Apr 2009 15:34:50 -0000 1.9 +++ gmap_plugin_style_gmap.inc 12 May 2009 23:04:12 -0000 @@ -29,6 +29,8 @@ class gmap_plugin_style_gmap extends vie $options['markers'] = array('default' => 'static'); $options['markertype'] = array('default' => 'drupal'); + $options['center_on_nodearg'] = array('default' => '0'); + $options['latfield'] = array('default' => ''); $options['lonfield'] = array('default' => ''); $options['markerfield'] = array('default' => ''); @@ -139,6 +141,14 @@ class gmap_plugin_style_gmap extends vie } if (!empty($markers)) { // Don't draw empty maps. $map = gmap_parse_macro($this->options['macro']); + if ($this->options['center_on_nodearg'] && $nodehandler = $this->view->display_handler->get_handler('argument', 'nid')) { + $nid = $nodehandler->get_value(); + if ($nid && $tempnode = node_load(array('nid' => $nid))) { + $map['longitude'] = $tempnode->location['longitude']; + $map['latitude'] = $tempnode->location['latitude']; + } + } + $map['markers'] = $markers; $output .= theme($this->theme_functions(), $this->view, $this->options, $map, $title); } @@ -151,6 +161,13 @@ class gmap_plugin_style_gmap extends vie */ function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); + $form['center_on_nodearg'] = array( + '#type' => 'checkbox', + '#title' => t('Center on node argument'), + '#default_value' => $this->options['center_on_nodearg'], + '#description' => t('Note: The view must contain a node by node id as an argument'), + ); + $form['macro'] = array( '#type' => 'textfield', '#title' => t('Macro'),