From 5289518d6a0c75ee0758cc4a4a777a8e03968ff2 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 9 Oct 2017 14:19:47 +0200 Subject: [PATCH] Allow empty standard layers. --- src/Listener/Dca/MapDcaListener.php | 3 ++- src/Resources/contao/dca/tl_leaflet_map.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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,