Rework map callbacks as a listener.

This commit is contained in:
David Molineus
2017-10-06 12:04:39 +02:00
parent f172c42426
commit 307381ddb6
5 changed files with 175 additions and 165 deletions

View File

@@ -0,0 +1,6 @@
services:
netzmacht.contao_leaflet_maps.listeners.dca.map:
class: Netzmacht\Contao\Leaflet\Listeners\Dca\MapDcaListener
arguments:
- '@netzmacht.contao_toolkit.dca.manager'
- '@database_connection'

View File

@@ -20,7 +20,7 @@ use Netzmacht\Contao\Leaflet\Dca\ControlCallbacks;
use Netzmacht\Contao\Leaflet\Dca\FrontendIntegration;
use Netzmacht\Contao\Leaflet\Dca\LayerCallbacks;
use Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks;
use Netzmacht\Contao\Leaflet\Dca\MapCallbacks;
use Netzmacht\Contao\Leaflet\Listeners\Dca\MapDcaListener;
use Netzmacht\Contao\Leaflet\Dca\Validator;
use Netzmacht\Contao\Leaflet\Dca\VectorCallbacks;
use Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices;
@@ -230,7 +230,7 @@ $container[LeafletServices::PARENT_ALIAS_GENERATOR] = $container->share(
$container['leaflet.dca.map-callbacks'] = $container->share(
function ($container) {
return new MapCallbacks(
return new MapDcaListener(
$container[Services::DCA_MANAGER],
$container[Services::DATABASE_CONNECTION]
);

View File

@@ -209,10 +209,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'exclude' => true,
'inputType' => 'multiColumnWizard',
'load_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('loadLayerRelations'),
['netzmacht.contao_leaflet_maps.listeners.dca.map', 'loadLayerRelations'],
),
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('saveLayerRelations'),
['netzmacht.contao_leaflet_maps.listeners.dca.map', 'saveLayerRelations'],
),
'eval' => array(
'multiple' => true,
@@ -223,7 +223,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['reference'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('getLayers'),
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.map', 'getLayers'],
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',