Files
contao-leaflet-maps/src/Bundle/ContaoManager/Plugin.php

72 lines
2.2 KiB
PHP
Raw Normal View History

2017-10-05 16:31:15 +02:00
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
2017-10-11 15:00:48 +02:00
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
2017-10-05 16:31:15 +02:00
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
2017-10-11 11:46:19 +02:00
declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Bundle\ContaoManager;
2017-10-05 16:31:15 +02:00
use Contao\CoreBundle\ContaoCoreBundle;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Contao\ManagerPlugin\Routing\RoutingPluginInterface;
2017-10-11 11:46:19 +02:00
use Netzmacht\Contao\Leaflet\Bundle\NetzmachtContaoLeafletBundle;
use Netzmacht\Contao\PageContext\NetzmachtContaoPageContextBundle;
2017-10-10 15:25:59 +02:00
use Netzmacht\Contao\Toolkit\Bundle\NetzmachtContaoToolkitBundle;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\RouteCollection;
2017-10-05 16:31:15 +02:00
/**
* Contao manager plugin.
*
* @package Netzmacht\Contao\Leaflet\ContaoManager
*/
class Plugin implements BundlePluginInterface, RoutingPluginInterface
2017-10-05 16:31:15 +02:00
{
/**
* {@inheritdoc}
*/
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create(NetzmachtContaoLeafletBundle::class)
->setLoadAfter(
[
ContaoCoreBundle::class,
NetzmachtContaoToolkitBundle::class,
NetzmachtContaoPageContextBundle::class
]
)
->setReplace(['leaflet']),
2017-10-05 16:31:15 +02:00
];
}
/**
* {@inheritdoc}
*/
public function getRouteCollection(LoaderResolverInterface $resolver, KernelInterface $kernel): ?RouteCollection
{
$loader = $resolver->resolve(__DIR__ . '/../Resources/config/routing.yml');
if (!$loader) {
return null;
}
$collection = $loader->load(__DIR__ . '/../Resources/config/routing.yml');
if ($collection instanceof RouteCollection) {
$collection->addPrefix('leaflet/api');
}
return $collection;
}
2017-10-05 16:31:15 +02:00
}