forked from Snck3rs/contao-leaflet-maps
Move bundle files to Bundle namespace.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Leaflet maps for Contao CMS.
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Bundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
|
||||
/**
|
||||
* Class NetzmachtContaoLeafletExtension.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\DependencyInjection
|
||||
*/
|
||||
class NetzmachtContaoLeafletExtension extends Extension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new YamlFileLoader(
|
||||
$container,
|
||||
new FileLocator(dirname(__DIR__) .'/Resources/config')
|
||||
);
|
||||
|
||||
// Common config, services and listeners
|
||||
$loader->load('config.yml');
|
||||
$loader->load('services.yml');
|
||||
$loader->load('listeners.yml');
|
||||
|
||||
// Amenities and providers config
|
||||
$loader->load('amenities.yml');
|
||||
$loader->load('providers.yml');
|
||||
|
||||
// Other services
|
||||
$loader->load('filters.yml');
|
||||
$loader->load('mappers.yml');
|
||||
$loader->load('encoders.yml');
|
||||
$loader->load('layers.yml');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Leaflet maps for Contao CMS.
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Bundle\DependencyInjection\Pass;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Register all definition mappers.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\DependencyInjection\Pass
|
||||
*/
|
||||
class RegisterDefinitionMapperPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('netzmacht.contao_leaflet_maps.definition.mapper')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('netzmacht.contao_leaflet_maps.definition.mapper');
|
||||
$taggedServices = $container->findTaggedServiceIds('netzmacht.contao_leaflet_maps.mapper');
|
||||
|
||||
foreach ($taggedServices as $serviceId => $tags) {
|
||||
foreach ($tags as $attributes) {
|
||||
if (isset($attributes['priority'])) {
|
||||
$definition->addMethodCall('register', [new Reference($serviceId), (int) $attributes['priority']]);
|
||||
} else {
|
||||
$definition->addMethodCall('register', [new Reference($serviceId)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/Bundle/DependencyInjection/Pass/RegisterEncodersPass.php
Normal file
44
src/Bundle/DependencyInjection/Pass/RegisterEncodersPass.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Leaflet maps for Contao CMS.
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Bundle\DependencyInjection\Pass;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Register all definition encoders.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\DependencyInjection\Pass
|
||||
*/
|
||||
class RegisterEncodersPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('netzmacht.contao_leaflet_maps.definition.builder.event_dispatcher')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('netzmacht.contao_leaflet_maps.definition.builder.event_dispatcher');
|
||||
$serviceIds = $container->findTaggedServiceIds('netzmacht.contao_leaflet_maps.encoder');
|
||||
|
||||
foreach (array_keys($serviceIds) as $serviceId) {
|
||||
$definition->addMethodCall('addSubscriber', [new Reference($serviceId)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Leaflet maps for Contao CMS.
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Bundle\DependencyInjection\Pass;
|
||||
|
||||
use Netzmacht\LeafletPHP\Assets;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Class RegisterLibrariesPass.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\DependencyInjection\Pass
|
||||
*/
|
||||
class RegisterLibrariesPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('netzmacht.contao_leaflet_maps.definition.builder')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$container->hasParameter('netzmacht.contao_leaflet_maps.libraries')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('netzmacht.contao_leaflet_maps.definition.builder');
|
||||
$libraries = $container->getParameter('netzmacht.contao_leaflet_maps.libraries');
|
||||
|
||||
foreach ($libraries as $name => $assets) {
|
||||
if (!empty($assets['css'])) {
|
||||
list ($source, $type) = (array) $assets['css'];
|
||||
$definition->addMethodCall('registerStylesheet', [$name, $source, $type ?: Assets::TYPE_FILE]);
|
||||
}
|
||||
|
||||
if (!empty($assets['javascript'])) {
|
||||
list ($source, $type) = (array) $assets['javascript'];
|
||||
$definition->addMethodCall('registerJavascript', [$name, $source, $type ?: Assets::TYPE_FILE]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user