mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-29 03:24:37 +01:00
Only load icon file if an icon exists (Fix #44).
This commit is contained in:
@@ -71,6 +71,13 @@ class BootSubscriber implements EventSubscriberInterface
|
|||||||
*/
|
*/
|
||||||
private $definitionMapper;
|
private $definitionMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag for loading icon file.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $loadIconFile = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BootSubscriber constructor.
|
* BootSubscriber constructor.
|
||||||
*
|
*
|
||||||
@@ -190,8 +197,11 @@ class BootSubscriber implements EventSubscriberInterface
|
|||||||
public function loadAssets()
|
public function loadAssets()
|
||||||
{
|
{
|
||||||
$this->assets->addJavascript('assets/leaflet/maps/contao-leaflet.js', ContaoAssets::TYPE_FILE);
|
$this->assets->addJavascript('assets/leaflet/maps/contao-leaflet.js', ContaoAssets::TYPE_FILE);
|
||||||
|
|
||||||
|
if ($this->loadIconFile) {
|
||||||
$this->assets->addJavascript('assets/leaflet/js/icons.js', ContaoAssets::TYPE_FILE);
|
$this->assets->addJavascript('assets/leaflet/js/icons.js', ContaoAssets::TYPE_FILE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load icons.
|
* Load icons.
|
||||||
@@ -233,6 +243,8 @@ class BootSubscriber implements EventSubscriberInterface
|
|||||||
$file = new \File('assets/leaflet/js/icons.js');
|
$file = new \File('assets/leaflet/js/icons.js');
|
||||||
$file->write($buffer);
|
$file->write($buffer);
|
||||||
$file->close();
|
$file->close();
|
||||||
|
|
||||||
|
$this->loadIconFile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user