I show a map with locpick behavior, but the "locpick" marker isn't visible until I click the map. Added my example code and a patch to set initial marker if there is one.

$map_id = gmap_get_auto_mapid();

$map = array_merge(gmap_defaults(), gmap_parse_macro('[gmap zoom=13|width=100%|height=500px|control=Large|type=Map]'));

$map['id'] = $map_id;

$map['points'] = array();
$map['pointsOverlays'] = array();
$map['lines'] = array();

$map['behavior']['locpick'] = TRUE;
$map['behavior']['collapsehack'] = TRUE;

$map['latitude'] = $location->latitude;
$map['longitude'] = $location->longitude;

$form['latitude']['#map'] = $map_id;
gmap_widget_setup($form['latitude'], 'locpick_latitude');

$form['longitude']['#map'] = $map_id;
gmap_widget_setup($form['longitude'], 'locpick_longitude');

$form['map'] = array(
  '#type' => 'gmap',
  '#gmap_settings' => $map,
);  

Comments

logaritmisk’s picture

StatusFileSize
new837 bytes

Oups, that didn't work like it should. New patch.

podarok’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Needs review » Needs work

thanks
commited pushed to 7.x-2.x dev

need backport to 7.x-1.x-dev

andriy: [19:12] /backups/gmap# git checkout 7.x-1.x
Switched to branch '7.x-1.x'
andriy: [19:12] /backups/gmap# git apply --check locpick_no_marker-1847676-1.patch
error: patch failed: js/locpick.js:11
error: js/locpick.js: patch does not apply
podarok’s picture

tagging