diff --git a/assets/maps/contao-leaflet.js b/assets/maps/contao-leaflet.js
index 2d42c8e..68b2814 100644
--- a/assets/maps/contao-leaflet.js
+++ b/assets/maps/contao-leaflet.js
@@ -1 +1 @@
-L.Contao=L.Class.extend({includes:L.Mixin.Events,statics:{ATTRIBUTION:' | netzmacht'},maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images/",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,o){return this.maps[t]=o,this.fire("map:added",{id:t,map:o}),this},getMap:function(t){return"undefined"==typeof this.maps[t]?null:this.maps[t]},addIcon:function(t,o){return this.icons[t]=o,this.fire("icon:added",{id:t,icon:o}),this},loadIcons:function(t){for(var o=0;o=200&&t<300||304===t}function i(){void 0===r.status||n(r.status)?o.call(r,null,r):o.call(r,r,null)}var s=!1;if("undefined"==typeof window.XMLHttpRequest)return o(Error("Browser not supported"));if("undefined"==typeof e){var a=t.match(/^\s*https?:\/\/[^\/]*/);e=a&&a[0]!==location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}var r=new window.XMLHttpRequest;if(e&&!("withCredentials"in r)){r=new window.XDomainRequest;var p=o;o=function(){if(s)p.apply(this,arguments);else{var t=this,o=arguments;setTimeout(function(){p.apply(t,o)},0)}}}return"onload"in r?r.onload=i:r.onreadystatechange=function(){4===r.readyState&&i()},r.onerror=function(t){o.call(this,t||!0,null),o=function(){}},r.onprogress=function(){},r.ontimeout=function(t){o.call(this,t,null),o=function(){}},r.onabort=function(t){o.call(this,t,null),o=function(){}},r.open("GET",t,!0),r.send(null),s=!0,r}});
\ No newline at end of file
+L.Contao=L.Class.extend({includes:L.Mixin.Events,statics:{ATTRIBUTION:' | netzmacht'},maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images/",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,o){return this.maps[t]=o,this.fire("map:added",{id:t,map:o}),this},getMap:function(t){return"undefined"==typeof this.maps[t]?null:this.maps[t]},addIcon:function(t,o){return this.icons[t]=o,this.fire("icon:added",{id:t,icon:o}),this},loadIcons:function(t){for(var o=0;o=200&&t<300||304===t}function i(){void 0===a.status||n(a.status)?o.call(a,null,a):o.call(a,a,null)}var s=!1;if("undefined"==typeof window.XMLHttpRequest)return o(Error("Browser not supported"));if("undefined"==typeof e){var r=t.match(/^\s*https?:\/\/[^\/]*/);e=r&&r[0]!==location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}var a=new window.XMLHttpRequest;if(e&&!("withCredentials"in a)){a=new window.XDomainRequest;var p=o;o=function(){if(s)p.apply(this,arguments);else{var t=this,o=arguments;setTimeout(function(){p.apply(t,o)},0)}}}return"onload"in a?a.onload=i:a.onreadystatechange=function(){4===a.readyState&&i()},a.onerror=function(t){o.call(this,t||!0,null),o=function(){}},a.onprogress=function(){},a.ontimeout=function(t){o.call(this,t,null),o=function(){}},a.onabort=function(t){o.call(this,t,null),o=function(){}},a.open("GET",t,!0),a.send(null),s=!0,a}});
\ No newline at end of file
diff --git a/assets/maps/src/Contao.js b/assets/maps/src/Contao.js
index 243addd..5912337 100644
--- a/assets/maps/src/Contao.js
+++ b/assets/maps/src/Contao.js
@@ -89,7 +89,14 @@ L.Contao = L.Class.extend({
*/
loadIcons: function (icons) {
for (var i = 0; i < icons.length; i++) {
- var icon = L[icons[i].type](icons[i].options);
+ var icon;
+
+ if (icons[i].type === 'extraMarkers.icon') {
+ icon = L.ExtraMarkers.icon(icons[i].options);
+ } else {
+ icon = L[icons[i].type](icons[i].options);
+ }
+
this.addIcon(icons[i].id, icon);
}
},
diff --git a/assets/maps/src/OverpassLayer.js b/assets/maps/src/OverpassLayer.js
index 9eaf599..dbba683 100644
--- a/assets/maps/src/OverpassLayer.js
+++ b/assets/maps/src/OverpassLayer.js
@@ -103,7 +103,6 @@ L.OverPassLayer = L.FeatureGroup.extend({
&& feature.properties.tags.amenity
&& this.options.amenityIcons[feature.properties.tags.amenity]
) {
- console.log(this.options.amenityIcons[feature.properties.tags.amenity]);
icon = L.contao.getIcon(this.options.amenityIcons[feature.properties.tags.amenity]);
}
diff --git a/module/config/config.php b/module/config/config.php
index 11c0100..f729f1b 100644
--- a/module/config/config.php
+++ b/module/config/config.php
@@ -154,6 +154,7 @@ $GLOBALS['LEAFLET_MAPPERS'][] = function () {
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\UI\PopupMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Type\ImageIconMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Type\DivIconMapper';
+$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Type\ExtraMarkersIconMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Style\FixedStyleMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new \Netzmacht\Contao\Leaflet\Mapper\UI\MarkerMapper(
@@ -301,7 +302,7 @@ $GLOBALS['LEAFLET_CONTROLS'] = array('zoom', 'layers', 'scale', 'attribution',
*
* Supported leaflet icon types. Register you type for the database driven definition here.
*/
-$GLOBALS['LEAFLET_ICONS'] = array('image', 'div');
+$GLOBALS['LEAFLET_ICONS'] = array('image', 'div', 'extra');
/*
diff --git a/module/dca/tl_leaflet_icon.php b/module/dca/tl_leaflet_icon.php
index ad7659a..e1c61f6 100644
--- a/module/dca/tl_leaflet_icon.php
+++ b/module/dca/tl_leaflet_icon.php
@@ -150,7 +150,21 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'active' => array(
'active'
)
- )
+ ),
+
+ 'extra extends default' => array(
+ 'config' => array(
+ 'icon',
+ 'prefix',
+ 'shape',
+ 'markerColor',
+ 'number',
+ 'iconColor',
+ ),
+ 'active' => array(
+ 'active'
+ )
+ ),
),
'fields' => array
@@ -351,5 +365,82 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
),
'sql' => "mediumtext NULL"
),
+ 'icon' => array
+ (
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['icon'],
+ 'exclude' => true,
+ 'inputType' => 'text',
+ 'eval' => array(
+ 'maxlength' => 64,
+ 'tl_class' => 'w50',
+ 'nullIfEmpty' => true,
+ ),
+ 'sql' => "varchar(64) NULL"
+ ),
+ 'prefix' => array
+ (
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['prefix'],
+ 'exclude' => true,
+ 'inputType' => 'text',
+ 'eval' => array(
+ 'maxlength' => 64,
+ 'tl_class' => 'w50',
+ 'nullIfEmpty' => true,
+ ),
+ 'sql' => "varchar(64) NULL"
+ ),
+ 'shape' => array
+ (
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['shape'],
+ 'exclude' => true,
+ 'inputType' => 'select',
+ 'default' => 'circle',
+ 'options' => ['circle', 'square', 'star', 'penta'],
+ 'eval' => array(
+ 'tl_class' => 'w50',
+ ),
+ 'sql' => "varchar(64) NULL"
+ ),
+ 'iconColor' => array
+ (
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['iconColor'],
+ 'exclude' => true,
+ 'inputType' => 'text',
+ 'eval' => array(
+ 'maxlength' => 64,
+ 'tl_class' => 'w50',
+ 'nullIfEmpty' => true,
+ ),
+ 'sql' => "varchar(16) NULL"
+ ),
+ 'markerColor' => array
+ (
+ 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['markerColor'],
+ 'exclude' => true,
+ 'inputType' => 'select',
+ 'default' => 'circle',
+ 'options' => [
+ 'blue',
+ 'red',
+ 'orange-dark',
+ 'orange',
+ 'yellow',
+ 'blue-dark',
+ 'cyan',
+ 'purple',
+ 'violet',
+ 'pink',
+ 'green-dark',
+ 'green',
+ 'green-light',
+ 'black',
+ 'white'
+ ],
+ 'eval' => array(
+ 'tl_class' => 'w50',
+ 'nullIfEmpty' => true,
+ ),
+ 'sql' => "varchar(16) NULL"
+ ),
),
);
diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Type/ExtraMarkersIconMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Type/ExtraMarkersIconMapper.php
new file mode 100644
index 0000000..a78aed7
--- /dev/null
+++ b/src/Netzmacht/Contao/Leaflet/Mapper/Type/ExtraMarkersIconMapper.php
@@ -0,0 +1,66 @@
+
+ * @copyright 2014-2016 netzmacht David Molineus
+ * @license LGPL 3.0
+ * @filesource
+ *
+ */
+
+namespace Netzmacht\Contao\Leaflet\Mapper\Type;
+
+use Netzmacht\Contao\Leaflet\Filter\Filter;
+use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
+use Netzmacht\LeafletPHP\Definition;
+use Netzmacht\LeafletPHP\Definition\Type\DivIcon;
+
+/**
+ * Class DivIconMapper maps the icon model to the div icon definition.
+ *
+ * @package Netzmacht\Contao\Leaflet\Mapper\Type
+ */
+class ExtraMarkersIconMapper extends AbstractIconMapper
+{
+ /**
+ * Class of the definition being created.
+ *
+ * @var string
+ */
+ protected static $definitionClass = 'Netzmacht\LeafletPHP\Plugins\ExtraMarkers\ExtraMarkersIcon';
+
+ /**
+ * Layer type.
+ *
+ * @var string
+ */
+ protected static $type = 'extra';
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function initialize()
+ {
+ parent::initialize();
+
+ $this->optionsBuilder->addOptions(['icon', 'iconColor', 'markerColor', 'shape', 'number', 'prefix']);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function build(
+ Definition $definition,
+ \Model $model,
+ DefinitionMapper $mapper,
+ Filter $filter = null,
+ Definition $parent = null
+ ) {
+ parent::build($definition, $model, $mapper, $filter);
+
+ if ($definition instanceof DivIcon && $model->iconSize) {
+ $definition->setIconSize(explode(',', $model->iconSize, 2));
+ }
+ }
+}