diff --git a/src/Listener/Dca/MapDcaListener.php b/src/Listener/Dca/MapDcaListener.php index a3af283..2c20b8e 100644 --- a/src/Listener/Dca/MapDcaListener.php +++ b/src/Listener/Dca/MapDcaListener.php @@ -15,6 +15,7 @@ declare(strict_types=1); namespace Netzmacht\Contao\Leaflet\Listener\Dca; use Contao\DataContainer; +use Contao\StringUtil; use Doctrine\DBAL\Connection; use Netzmacht\Contao\Leaflet\Model\LayerModel; use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener; @@ -88,7 +89,7 @@ class MapDcaListener extends AbstractListener */ public function saveLayerRelations($layerId, $dataContainer) { - $new = deserialize($layerId, true); + $new = array_filter(StringUtil::deserialize($layerId, true)); $values = array(); $statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting'); diff --git a/src/Resources/contao/dca/tl_leaflet_map.php b/src/Resources/contao/dca/tl_leaflet_map.php index 43cef78..1574705 100644 --- a/src/Resources/contao/dca/tl_leaflet_map.php +++ b/src/Resources/contao/dca/tl_leaflet_map.php @@ -224,7 +224,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array 'inputType' => 'select', 'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.map', 'getLayers'], 'eval' => array( - 'mandatory' => true, + 'mandatory' => false, 'tl_class' => 'w50', 'chosen' => true, 'includeBlankOption' => true,