mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-30 20:13:49 +01:00
Add icon support.
This commit is contained in:
@@ -14,7 +14,9 @@ namespace Netzmacht\Contao\Leaflet\Mapper\UI;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Mapper\AbstractMapper;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\Icon;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
|
||||
use Netzmacht\LeafletPHP\Definition\UI\Marker;
|
||||
|
||||
@@ -69,6 +71,20 @@ class MarkerMapper extends AbstractMapper
|
||||
if ($model->addPopup) {
|
||||
$definition->bindPopup($model->popupContent);
|
||||
}
|
||||
|
||||
if ($model->customIcon) {
|
||||
$iconModel = IconModel::findBy(
|
||||
array('id=?', 'active=1'),
|
||||
array($model->icon),
|
||||
array('return' => 'Model')
|
||||
);
|
||||
|
||||
if ($iconModel) {
|
||||
/** @var Icon $icon */
|
||||
$icon = $builder->handle($iconModel);
|
||||
$definition->setIcon($icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user