forked from Snck3rs/contao-leaflet-maps
Use OptionsBuilder in all mapper classes.
This commit is contained in:
@@ -56,90 +56,6 @@ abstract class AbstractMapper implements Mapper
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a option mapping.
|
||||
*
|
||||
* @param string $option Name of the option.
|
||||
* @param string $mapping Mapping column name. Set if column name differs.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addOption($option, $mapping = null)
|
||||
{
|
||||
trigger_error(
|
||||
__METHOD__ . ' is deprecated. Use $this->optionsBuilder->' . __FUNCTION__ . '()',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
|
||||
$this->optionsBuilder->addOption($option, $mapping);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add options mapping.
|
||||
*
|
||||
* @param array|mixed $options List of option names.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addOptions($options)
|
||||
{
|
||||
trigger_error(
|
||||
__METHOD__ . ' is deprecated. Use $this->optionsBuilder->' . __FUNCTION__ . '()',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
|
||||
$arguments = func_get_args();
|
||||
|
||||
$this->optionsBuilder->addOptions($arguments);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a conditional option.
|
||||
*
|
||||
* @param string $column Condition column.
|
||||
* @param string $option Option name.
|
||||
* @param null $mapping Mapping column name.
|
||||
* @param mixed $value Value of the conditional column.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addConditionalOption($column, $option = null, $mapping = null, $value = self::VALUE_NOT_EMPTY)
|
||||
{
|
||||
trigger_error(
|
||||
__METHOD__ . ' is deprecated. Use $this->optionsBuilder->' . __FUNCTION__ . '()',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
|
||||
$this->optionsBuilder->addConditionalOption($column, $option, $mapping, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a conditional options.
|
||||
*
|
||||
* @param string $column Condition column.
|
||||
* @param array $options Option names.
|
||||
* @param mixed $value Value of the conditional column.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addConditionalOptions($column, array $options, $value = self::VALUE_NOT_EMPTY)
|
||||
{
|
||||
trigger_error(
|
||||
__METHOD__ . ' is deprecated. Use $this->optionsBuilder->' . __FUNCTION__ . '()',
|
||||
E_USER_DEPRECATED
|
||||
);
|
||||
|
||||
$this->optionsBuilder->addConditionalOptions($column, $options, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,6 @@ class AbstractControlMapper extends AbstractTypeMapper
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$this->addOption('position');
|
||||
$this->optionsBuilder->addOption('position');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class AttributionControlMapper extends AbstractControlMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->addConditionalOption('prefix');
|
||||
$this->optionsBuilder->addConditionalOption('prefix');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ class FullscreenControlMapper extends AbstractControlMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this
|
||||
$this->optionsBuilder
|
||||
->addOption('forceSeparateButton', 'separate')
|
||||
->addConditionalOption('title', 'title', 'buttonTitle')
|
||||
->addOption('forcePseudoFullScreen', 'simulateFullScreen');
|
||||
|
||||
@@ -59,7 +59,7 @@ class LoadingControlMapper extends AbstractControlMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->addOption('separate');
|
||||
$this->optionsBuilder->addOption('separate');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,6 +39,6 @@ class ScaleControlMapper extends AbstractControlMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->addOptions('maxWidth', 'metric', 'imperial', 'updateWhenIdle');
|
||||
$this->optionsBuilder->addOptions('maxWidth', 'metric', 'imperial', 'updateWhenIdle');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class ZoomControlMapper extends AbstractControlMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this
|
||||
$this->optionsBuilder
|
||||
->addConditionalOption('zoomInText')
|
||||
->addConditionalOption('zoomOutText')
|
||||
->addConditionalOption('zoomInTitle')
|
||||
|
||||
@@ -34,6 +34,6 @@ class AbstractLayerMapper extends AbstractTypeMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->addOption('label', 'title');
|
||||
$this->optionsBuilder->addOption('label', 'title');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction;
|
||||
use Netzmacht\JavascriptBuilder\Type\Expression;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\HasEvents;
|
||||
use Netzmacht\LeafletPHP\Definition\Layer;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Plugins\MarkerCluster\MarkerClusterGroup;
|
||||
@@ -50,7 +49,7 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this
|
||||
$this->optionsBuilder
|
||||
->addOptions('showCoverageOnHover', 'zoomToBoundsOnClick', 'spiderfyOnMaxZoom')
|
||||
->addOption('removeOutsideVisibleBounds')
|
||||
->addConditionalOption('maxClusterRadius')
|
||||
|
||||
@@ -45,7 +45,7 @@ class MapMapper extends AbstractMapper
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$this
|
||||
$this->optionsBuilder
|
||||
->addOptions('center', 'zoom', 'zoomControl')
|
||||
->addOptions('dragging', 'touchZoom', 'scrollWheelZoom', 'doubleClickZoom', 'boxZoom', 'tap', 'keyboard')
|
||||
->addOptions('trackResize', 'closeOnClick', 'bounceAtZoomLimits')
|
||||
|
||||
@@ -41,7 +41,7 @@ class FixedStyleMapper extends AbstractStyleMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this
|
||||
$this->optionsBuilder
|
||||
->addOptions('stroke', 'weight', 'opacity', 'clickable', 'className')
|
||||
->addConditionalOption('color')
|
||||
->addConditionalOption('lineCap')
|
||||
|
||||
@@ -32,6 +32,6 @@ class AbstractIconMapper extends AbstractTypeMapper
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$this->addConditionalOption('className');
|
||||
$this->optionsBuilder->addConditionalOption('className');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class DivIconMapper extends AbstractIconMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->addOption('html');
|
||||
$this->optionsBuilder->addOption('html');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,7 +60,7 @@ class MarkerMapper extends AbstractMapper
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$this
|
||||
$this->optionsBuilder
|
||||
->addConditionalOption('tooltip', 'title', 'tooltip')
|
||||
->addConditionalOption('alt')
|
||||
->addConditionalOption('zIndexOffset')
|
||||
|
||||
@@ -45,7 +45,7 @@ class CircleMapper extends AbstractVectorMapper
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->addOption('radius');
|
||||
$this->optionsBuilder->addOption('radius');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user