diff --git a/assets/libs/contao/contao-leaflet.js b/assets/libs/contao/contao-leaflet.js index 33d1595..43b3f49 100644 --- a/assets/libs/contao/contao-leaflet.js +++ b/assets/libs/contao/contao-leaflet.js @@ -37,11 +37,13 @@ L.Contao = L.Class.extend({ }); }); - // Set default pointToLayer and onEachFeature handler. - L.GeoJSON.AJAX.prototype.options = L.Util.extend({}, L.GeoJSON.AJAX.prototype.options, { - pointToLayer: this.pointToLayer.bind(this), - onEachFeature: this.onEachFeature.bind(this) - }); + if (L.GeoJSON.AJAX) { + // Set default pointToLayer and onEachFeature handler. + L.GeoJSON.AJAX.prototype.options = { + pointToLayer: this.pointToLayer.bind(this), + onEachFeature: this.onEachFeature.bind(this) + }; + } }, /** diff --git a/module/dca/tl_leaflet_layer.php b/module/dca/tl_leaflet_layer.php index 7d76bea..8c3a028 100644 --- a/module/dca/tl_leaflet_layer.php +++ b/module/dca/tl_leaflet_layer.php @@ -5,8 +5,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array ( 'config' => array( - 'dataContainer' => 'Table', - 'enableVersioning' => true, + 'dataContainer' => 'Table', + 'enableVersioning' => true, + 'ctable' => array('tl_leaflet_vector', 'tl_leaflet_marker'), + 'ondelete_callback' => array( + array('Netzmacht\Contao\Leaflet\Dca\Layer', 'deleteRelations'), + ), 'sql' => array ( 'keys' => array @@ -15,7 +19,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array 'pid' => 'index', 'alias' => 'unique', ) - ) + ), ), 'list' => array (