Refactor frontend integration using dependency injection.

This commit is contained in:
David Molineus
2016-10-06 08:34:55 +02:00
parent 4e4380270b
commit 2c9dd0ad48
4 changed files with 53 additions and 10 deletions

View File

@@ -14,6 +14,7 @@ use Netzmacht\Contao\Leaflet\Alias\DefaultAliasFilter;
use Netzmacht\Contao\Leaflet\Boot;
use Netzmacht\Contao\Leaflet\ContaoAssets;
use Netzmacht\Contao\Leaflet\Dca\ControlCallbacks;
use Netzmacht\Contao\Leaflet\Dca\FrontendIntegration;
use Netzmacht\Contao\Leaflet\Dca\LayerCallbacks;
use Netzmacht\Contao\Leaflet\Dca\MapCallbacks;
use Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices;
@@ -199,6 +200,19 @@ $container['leaflet.dca.control-callbacks'] = $container->share(
}
);
/**
* Callback helper class for frontend integration.
*
* @return FrontendIntegration
*/
$container['leaflet.dca.frontend-integration'] = $container->share(
function ($container) {
return new FrontendIntegration(
$container[Services::TRANSLATOR]
);
}
);
/**
* Component factory for content element.
*