diff --git a/build.default.properties b/build.default.properties index 06357d7..c08524f 100644 --- a/build.default.properties +++ b/build.default.properties @@ -1,4 +1,4 @@ phpcs.standard = ${basedir}/vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/ruleset.xml phpmd.ruleset = ${basedir}/vendor/phpcq/coding-standard/phpmd/ruleset.xml -phpcs.excluded = src/Resources/contao/languages +phpcs.excluded = src/Resources/contao/languages,src/Resources/public/js phpcpd.excluded = contao diff --git a/src/Frontend/Assets/LibrariesConfiguration.php b/src/Frontend/Assets/LibrariesConfiguration.php index 2709f7c..94ad1b9 100644 --- a/src/Frontend/Assets/LibrariesConfiguration.php +++ b/src/Frontend/Assets/LibrariesConfiguration.php @@ -15,16 +15,17 @@ declare(strict_types=1); namespace Netzmacht\Contao\Leaflet\Frontend\Assets; use Contao\CoreBundle\Framework\ContaoFrameworkInterface as ContaoFramework; -use Traversable; /** - * Class LibrariesConfiguration + * Class LibrariesConfiguration. * * @package Netzmacht\Contao\Leaflet\Frontend\Assets */ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess { /** + * Contao framework. + * * @var ContaoFramework */ private $framework; @@ -32,7 +33,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess /** * LibrariesConfiguration constructor. * - * @param ContaoFramework $framework + * @param ContaoFramework $framework Contao framework. */ public function __construct(ContaoFramework $framework) { @@ -70,6 +71,8 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess */ public function offsetGet($offset) { + $this->framework->initialize(); + return $GLOBALS['LEAFLET_LIBRARIES'][$offset]; } @@ -80,6 +83,8 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess */ public function offsetSet($offset, $value) { + $this->framework->initialize(); + $GLOBALS['LEAFLET_LIBRARIES'][$offset] = $value; } @@ -90,6 +95,8 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess */ public function offsetUnset($offset) { + $this->framework->initialize(); + unset($GLOBALS['LEAFLET_LIBRARIES'][$offset]); } } diff --git a/src/MapProvider.php b/src/MapProvider.php index 99192ee..631b404 100644 --- a/src/MapProvider.php +++ b/src/MapProvider.php @@ -95,7 +95,7 @@ class MapProvider * @param DefinitionMapper $mapper The definition mapper. * @param Leaflet $leaflet The Leaflet instance. * @param EventDispatcher $eventDispatcher The Contao event dispatcher. - * @param Input $input Thw request input. + * @param Input $input Thw request input. * @param ContaoAssets $assets Assets handler. * @param Cache $cache Cache. * @param array $filters Request filters configuration. diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 2e00219..8d928ec 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -88,6 +88,7 @@ $GLOBALS['TL_MODELS']['tl_leaflet_vector'] = \Netzmacht\Contao\Leaflet\Model\Ve /* * Hooks. */ + $GLOBALS['TL_HOOKS']['initializeSystem'][] = [ 'netzmacht.contao_leaflet_maps.listeners.register_libraries', 'onInitializeSystem'