Support popups.

This commit is contained in:
David Molineus
2016-11-14 11:50:20 +01:00
parent f462a11c1d
commit cb370f6723
4 changed files with 26 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@@ -110,8 +110,10 @@ L.OverPassLayer = L.FeatureGroup.extend({
if (icon) {
marker.setIcon(icon);
}
}
L.contao.bindPopupFromFeature(marker, feature);
if (this.options.overpassPopup) {
marker.bindPopup(this.options.overpassPopup(feature, marker));
}
this._map.fire('point:added', {marker: marker, feature: feature, latlng: latlng, type: type});
@@ -122,7 +124,9 @@ L.OverPassLayer = L.FeatureGroup.extend({
if (feature.properties) {
L.Util.setOptions(layer, feature.properties.options);
L.contao.bindPopupFromFeature(layer, feature);
if (this.options.overpassPopup) {
layer.bindPopup(this.options.overpassPopup(feature, layer));
}
this._map.fire('feature:added', {feature: feature, layer: layer});
}

View File

@@ -221,6 +221,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'boundsMode',
'minZoom',
'overpassEndpoint',
'overpassPopup'
),
'style' => array(
'amenityIcons'
@@ -911,5 +912,19 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
),
'sql' => "blob NULL",
),
'overpassPopup' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['overpassPopup'],
'exclude' => true,
'inputType' => 'textarea',
'eval' => array(
'preserveTags' => true,
'decodeEntities' => true,
'allowHtml' => true,
'rte' => 'ace|javascript',
'tl_class' => 'clr'
),
'sql' => "mediumtext NULL"
),
)
);

View File

@@ -77,6 +77,10 @@ class OverpassLayerMapper extends AbstractLayerMapper
if ($model->onEachFeature) {
$definition->setOnEachFeature(new Expression($model->onEachFeature));
}
if ($model->overpassPopup) {
$definition->setOption('overpassPopup', new Expression($model->overpassPopup));
}
}
/**