If #edit is TRUE on a map element, enable the edit behavior.
This commit is contained in:
parent
cd800b73f4
commit
8baceff31f
|
@ -28,6 +28,9 @@ function farm_map_farm_map_view($name, $element) {
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'zoom' => TRUE,
|
'zoom' => TRUE,
|
||||||
);
|
);
|
||||||
|
if (!empty($element['#edit'])) {
|
||||||
|
$settings['edit'] = TRUE;
|
||||||
|
}
|
||||||
farm_map_add_behavior('wkt', $settings);
|
farm_map_add_behavior('wkt', $settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,15 @@
|
||||||
var layer = instance.addLayer(type, opts);
|
var layer = instance.addLayer(type, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If edit is true, enable drawing controls.
|
||||||
|
if (Drupal.settings.farm_map.behaviors.wkt.edit) {
|
||||||
|
if (layer !== undefined) {
|
||||||
|
instance.addBehavior('edit', { layer: layer });
|
||||||
|
} else {
|
||||||
|
instance.addBehavior('edit');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If zoom is true and the layer has features, zoom to them.
|
// If zoom is true and the layer has features, zoom to them.
|
||||||
// Otherwise, zoom to all vectors.
|
// Otherwise, zoom to all vectors.
|
||||||
if (Drupal.settings.farm_map.behaviors.wkt.zoom) {
|
if (Drupal.settings.farm_map.behaviors.wkt.zoom) {
|
||||||
|
|
Loading…
Reference in New Issue