From c5c4810837d5b6f0b6d15d138669db88d9097772 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Mon, 12 Jan 2015 09:29:48 +0100 Subject: [PATCH] Add standalone feature to the reference map. --- module/dca/tl_leaflet_layer.php | 11 ++++++++++- module/languages/en/tl_leaflet_layer.php | 3 +++ .../Leaflet/Mapper/Layer/ReferenceLayerMapper.php | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/module/dca/tl_leaflet_layer.php b/module/dca/tl_leaflet_layer.php index c868861..3c5ef83 100644 --- a/module/dca/tl_leaflet_layer.php +++ b/module/dca/tl_leaflet_layer.php @@ -147,7 +147,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array '+active' => array('deferred'), ), 'reference extends default' => array( - '+title' => array('reference') + '+title' => array('reference', 'standalone') ) ), @@ -324,6 +324,15 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array ), 'sql' => "int(10) unsigned NOT NULL default '0'", ), + 'standalone' => array + ( + 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['standalone'], + 'exclude' => true, + 'inputType' => 'checkbox', + 'default' => false, + 'eval' => array('tl_class' => 'w50', 'submitOnChange' => false, 'isBoolean' => true), + 'sql' => "char(1) NOT NULL default ''" + ), 'onEachFeature' => array ( 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['onEachFeature'], diff --git a/module/languages/en/tl_leaflet_layer.php b/module/languages/en/tl_leaflet_layer.php index 94b81c5..64ea661 100644 --- a/module/languages/en/tl_leaflet_layer.php +++ b/module/languages/en/tl_leaflet_layer.php @@ -3,6 +3,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['title_legend'] = 'Layer'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['active_legend'] = 'Activation'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['expert_legend'] = 'Expert settings'; +$GLOBALS['TL_LANG']['tl_leaflet_layer']['config_legend'] = 'Configuration'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['map'][0] = 'Manage maps'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['map'][1] = 'Manage leaflet maps'; @@ -39,6 +40,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['active'][0] = 'Activate $GLOBALS['TL_LANG']['tl_leaflet_layer']['active'][1] = 'Activate layer on the map.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'][0] = 'Reference'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'][1] = 'Choose the reference layer.'; +$GLOBALS['TL_LANG']['tl_leaflet_layer']['standalone'][0] = 'Standalone'; +$GLOBALS['TL_LANG']['tl_leaflet_layer']['standalone'][1] = 'Integrate reference as a copy of the referenced layer.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['markerCluster'][0] = 'Marker cluster'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['markerCluster'][1] = 'Choose a marker cluster layer so that markers get clustered.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['deferred'][0] = 'Deferred loading'; diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/ReferenceLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/ReferenceLayerMapper.php index d213da5..711f947 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/ReferenceLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/ReferenceLayerMapper.php @@ -40,6 +40,8 @@ class ReferenceLayerMapper extends AbstractLayerMapper return null; } - return $mapper->handle($reference, $bounds, $this->getElementId($model, $elementId)); + $elementId = $model->standalone ? $this->getElementId($model, $elementId) : null; + + return $mapper->handle($reference, $bounds, $elementId); } }