mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-28 19:13:55 +01:00
Add option to replace default attribution control.
This commit is contained in:
@@ -115,7 +115,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
||||
'config' => array('maxWidth', 'metric', 'imperial', 'updateWhenIdle')
|
||||
),
|
||||
'attribution extends default' => array(
|
||||
'config' => array('attributions', 'prefix')
|
||||
'config' => array('attributions', 'prefix', 'disableDefault')
|
||||
),
|
||||
'loading extends default' => array(
|
||||
'config' => array('separate', 'zoomControl', 'spinjs')
|
||||
@@ -418,5 +418,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50'),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
),
|
||||
'disableDefault' => array
|
||||
(
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['disableDefault'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'default' => true,
|
||||
'eval' => array('tl_class' => 'w50 m12'),
|
||||
'sql' => "char(1) NOT NULL default ''"
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -75,6 +75,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_control']['buttonTitle'][0] = 'Button tit
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_control']['buttonTitle'][1] = 'Title attribute of the control button.';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_control']['simulateFullScreen'][0] = 'Always simulate fullscreen';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_control']['simulateFullScreen'][1] = 'Simulate fullscreen no matter if the browser supports the Fullscreen API.';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_control']['disableDefault'][0] = 'Replace default control';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_control']['disableDefault'][1] = 'If enabled the default control will be disabled.';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_control']['bottomleft'][0] = 'Bottom left';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_control']['bottomleft'][1] = 'Bottom left of the map.';
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Control;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Control\Attribution;
|
||||
use Netzmacht\LeafletPHP\Definition\Map;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
|
||||
/**
|
||||
@@ -61,6 +62,10 @@ class AttributionControlMapper extends AbstractControlMapper
|
||||
return;
|
||||
}
|
||||
|
||||
if ($model->disableDefault && $parent instanceof Map) {
|
||||
$parent->setAttributionControl(false);
|
||||
}
|
||||
|
||||
$attributions = deserialize($model->attributions, true);
|
||||
|
||||
foreach ($attributions as $attribution) {
|
||||
|
||||
Reference in New Issue
Block a user