Add icon support.

This commit is contained in:
David Molineus
2015-01-06 21:30:57 +01:00
parent 3608f7cd48
commit adc8de55ae
11 changed files with 367 additions and 136 deletions

View File

@@ -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);
}
}
}
}
}