Allow empty standard layers.

This commit is contained in:
David Molineus
2017-10-09 14:19:47 +02:00
parent a5fbba740b
commit 5289518d6a
2 changed files with 3 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Listener\Dca; namespace Netzmacht\Contao\Leaflet\Listener\Dca;
use Contao\DataContainer; use Contao\DataContainer;
use Contao\StringUtil;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Netzmacht\Contao\Leaflet\Model\LayerModel; use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener; use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
@@ -88,7 +89,7 @@ class MapDcaListener extends AbstractListener
*/ */
public function saveLayerRelations($layerId, $dataContainer) public function saveLayerRelations($layerId, $dataContainer)
{ {
$new = deserialize($layerId, true); $new = array_filter(StringUtil::deserialize($layerId, true));
$values = array(); $values = array();
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting'); $statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');

View File

@@ -224,7 +224,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'inputType' => 'select', 'inputType' => 'select',
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.map', 'getLayers'], 'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.map', 'getLayers'],
'eval' => array( 'eval' => array(
'mandatory' => true, 'mandatory' => false,
'tl_class' => 'w50', 'tl_class' => 'w50',
'chosen' => true, 'chosen' => true,
'includeBlankOption' => true, 'includeBlankOption' => true,