mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2026-01-18 05:15:16 +01:00
Get rid of ServiceContainerTrait. Use dependency injection where possible.
This commit is contained in:
@@ -12,11 +12,11 @@
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\UI;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\AbstractMapper;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
||||
use Netzmacht\Contao\Leaflet\ServiceContainerTrait;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
||||
use Netzmacht\LeafletPHP\Definition\UI\Marker;
|
||||
@@ -29,8 +29,6 @@ use Netzmacht\LeafletPHP\Definition\UI\Popup;
|
||||
*/
|
||||
class MarkerMapper extends AbstractMapper
|
||||
{
|
||||
use ServiceContainerTrait;
|
||||
|
||||
/**
|
||||
* Class of the model being build.
|
||||
*
|
||||
@@ -45,6 +43,25 @@ class MarkerMapper extends AbstractMapper
|
||||
*/
|
||||
protected static $definitionClass = 'Netzmacht\LeafletPHP\Definition\UI\Marker';
|
||||
|
||||
/**
|
||||
* Frontend filter.
|
||||
*
|
||||
* @var ValueFilter
|
||||
*/
|
||||
protected $valueFilter;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param ValueFilter $valueFilter Frontend filter.
|
||||
*/
|
||||
public function __construct(ValueFilter $valueFilter)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->valueFilter = $valueFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -85,10 +102,7 @@ class MarkerMapper extends AbstractMapper
|
||||
if ($definition instanceof Marker) {
|
||||
if ($model->addPopup) {
|
||||
$popup = null;
|
||||
$content = $this
|
||||
->getServiceContainer()
|
||||
->getFrontendValueFilter()
|
||||
->filter($model->popupContent);
|
||||
$content = $this->valueFilter->filter($model->popupContent);
|
||||
|
||||
if ($model->popup) {
|
||||
$popupModel = PopupModel::findActiveByPK($model->popup);
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Definition\Style;
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\AbstractTypeMapper;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||
use Netzmacht\Contao\Leaflet\ServiceContainerTrait;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\HasPopup;
|
||||
use Netzmacht\LeafletPHP\Definition\UI\Popup;
|
||||
@@ -30,8 +30,6 @@ use Netzmacht\LeafletPHP\Definition\Vector\Path;
|
||||
*/
|
||||
class AbstractVectorMapper extends AbstractTypeMapper
|
||||
{
|
||||
use ServiceContainerTrait;
|
||||
|
||||
/**
|
||||
* Class of the model being build.
|
||||
*
|
||||
@@ -39,6 +37,25 @@ class AbstractVectorMapper extends AbstractTypeMapper
|
||||
*/
|
||||
protected static $modelClass = 'Netzmacht\Contao\Leaflet\Model\VectorModel';
|
||||
|
||||
/**
|
||||
* Frontend filter.
|
||||
*
|
||||
* @var ValueFilter
|
||||
*/
|
||||
protected $valueFilter;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param ValueFilter $valueFilter Frontend filter.
|
||||
*/
|
||||
public function __construct(ValueFilter $valueFilter)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->valueFilter = $valueFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -84,10 +101,7 @@ class AbstractVectorMapper extends AbstractTypeMapper
|
||||
) {
|
||||
if ($definition instanceof HasPopup && $model->addPopup) {
|
||||
$popup = null;
|
||||
$content = $this
|
||||
->getServiceContainer()
|
||||
->getFrontendValueFilter()
|
||||
->filter($model->popupContent);
|
||||
$content = $this->valueFilter->filter($model->popupContent);
|
||||
|
||||
if ($model->popup) {
|
||||
$popupModel = PopupModel::findActiveByPK($model->popup);
|
||||
|
||||
Reference in New Issue
Block a user