mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2026-01-17 21:05:17 +01:00
Fix code style issues.
This commit is contained in:
@@ -25,6 +25,7 @@ use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||
use Netzmacht\Contao\Toolkit\Boot\Event\InitializeSystemEvent;
|
||||
use Netzmacht\Contao\Toolkit\DependencyInjection\Services;
|
||||
use Netzmacht\LeafletPHP\Assets;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\Icon;
|
||||
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
@@ -218,23 +219,7 @@ class BootSubscriber implements EventSubscriberInterface
|
||||
'options' => $icon->getOptions(),
|
||||
);
|
||||
|
||||
foreach ($icon::getRequiredLibraries() as $library) {
|
||||
if (!isset($this->libraries[$library])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$assets = $this->libraries[$library];
|
||||
|
||||
if (!empty($assets['css'])) {
|
||||
list ($source, $type) = (array) $assets['css'];
|
||||
$this->assets->addStylesheet($source, $type ?: Assets::TYPE_FILE);
|
||||
}
|
||||
|
||||
if (!empty($assets['javascript'])) {
|
||||
list ($source, $type) = (array) $assets['javascript'];
|
||||
$this->assets->addJavascript($source, $type ?: Assets::TYPE_FILE);
|
||||
}
|
||||
}
|
||||
$this->loadIconsLibraries($icon);
|
||||
}
|
||||
|
||||
if ($icons) {
|
||||
@@ -266,4 +251,32 @@ class BootSubscriber implements EventSubscriberInterface
|
||||
|
||||
return new $mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all libraries for an icon.
|
||||
*
|
||||
* @param Icon $icon Icon definition
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
protected function loadIconsLibraries($icon)
|
||||
{
|
||||
foreach ($icon::getRequiredLibraries() as $library) {
|
||||
if (!isset($this->libraries[$library])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$assets = $this->libraries[$library];
|
||||
|
||||
if (!empty($assets['css'])) {
|
||||
list ($source, $type) = (array)$assets['css'];
|
||||
$this->assets->addStylesheet($source, $type ?: Assets::TYPE_FILE);
|
||||
}
|
||||
|
||||
if (!empty($assets['javascript'])) {
|
||||
list ($source, $type) = (array)$assets['javascript'];
|
||||
$this->assets->addJavascript($source, $type ?: Assets::TYPE_FILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user