Rewrite frontend components to work with toolkit v2.

This commit is contained in:
David Molineus
2016-10-05 08:12:34 +02:00
parent f8e28f3299
commit 7207d9e0e6
8 changed files with 192 additions and 174 deletions

View File

@@ -0,0 +1 @@
requires[] = 'toolkit'

View File

@@ -56,13 +56,13 @@ array_insert(
/*
* Content elements.
*/
$GLOBALS['TL_CTE']['includes']['leaflet'] = 'Netzmacht\Contao\Leaflet\Frontend\MapElement';
$GLOBALS['TL_CTE']['includes']['leaflet'] = 'Netzmacht\Contao\Toolkit\Component\ContentElement\ContentElementDecorator';
/*
* Frontend modules
*/
$GLOBALS['FE_MOD']['includes']['leaflet'] = 'Netzmacht\Contao\Leaflet\Frontend\MapModule';
$GLOBALS['FE_MOD']['includes']['leaflet'] = 'Netzmacht\Contao\Toolkit\Component\Module\ModuleDecorator';
/*

View File

@@ -9,9 +9,12 @@
*
*/
use Interop\Container\ContainerInterface;
use Netzmacht\Contao\Leaflet\Alias\UnderscoreFilter;
use Netzmacht\Contao\Leaflet\Boot;
use Netzmacht\Contao\Leaflet\ContaoAssets;
use Netzmacht\Contao\Leaflet\Frontend\MapElement;
use Netzmacht\Contao\Leaflet\Frontend\MapModule;
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\MapService;
@@ -180,3 +183,27 @@ $container['leaflet.dca.control-callbacks'] = $container->share(
);
}
);
$container[Services::CONTENT_ELEMENTS_MAP]['leaflet'] = function ($model, $column, ContainerInterface $container) {
return new MapElement(
$model,
$container->get(Services::TEMPLATE_FACTORY),
$container->get(Services::TRANSLATOR),
$container->get('leaflet.map.service'),
$container->get(Services::INPUT),
$container->get(Services::CONFIG),
$column
);
};
$container[Services::MODULES_MAP]['leaflet'] = function ($model, $column, ContainerInterface $container) {
return new MapModule(
$model,
$container->get(Services::TEMPLATE_FACTORY),
$container->get(Services::TRANSLATOR),
$container->get('leaflet.map.service'),
$container->get(Services::INPUT),
$container->get(Services::CONFIG),
$column
);
};