Rework control callbacks as a listener service.

This commit is contained in:
David Molineus
2017-10-06 13:17:49 +02:00
parent 307381ddb6
commit fde6c2b4c7
4 changed files with 58 additions and 55 deletions

View File

@@ -4,3 +4,9 @@ services:
arguments:
- '@netzmacht.contao_toolkit.dca.manager'
- '@database_connection'
netzmacht.contao_leaflet_maps.listeners.dca.control:
class: Netzmacht\Contao\Leaflet\Listeners\Dca\ControlDcaListener
arguments:
- '@netzmacht.contao_toolkit.dca.manager'
- '@database_connection'

View File

@@ -16,7 +16,7 @@ use Interop\Container\ContainerInterface;
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\Listeners\Dca\ControlDcaListener;
use Netzmacht\Contao\Leaflet\Dca\FrontendIntegration;
use Netzmacht\Contao\Leaflet\Dca\LayerCallbacks;
use Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks;
@@ -260,7 +260,7 @@ $container['leaflet.dca.layer-callbacks'] = $container->share(
$container['leaflet.dca.control-callbacks'] = $container->share(
function ($container) {
return new ControlCallbacks(
return new ControlDcaListener(
$container[Services::DCA_MANAGER],
$container[Services::DATABASE_CONNECTION]
);

View File

@@ -42,7 +42,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'flag' => 1,
'sorting' => 2,
'panelLayout' => 'filter,sort;search,limit',
'child_record_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('generateRow'),
'child_record_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.control', 'generateRow'],
),
'label' => array
(
@@ -286,10 +286,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'exclude' => true,
'inputType' => 'multiColumnWizard',
'load_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('loadLayerRelations'),
['netzmacht.contao_leaflet_maps.listeners.dca.control', 'loadLayerRelations'],
),
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('saveLayerRelations'),
['netzmacht.contao_leaflet_maps.listeners.dca.control', 'saveLayerRelations'],
),
'eval' => array
(
@@ -301,7 +301,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['layer'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('getLayers'),
'options_callback' => \Netzmacht\Contao\Leaflet\Listeners\Dca\ControlDcaListener::callback('getLayers'),
'eval' => array(
'style' => 'width: 300px',
'chosen' => true,
@@ -388,7 +388,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('getZoomControls'),
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.control', 'getZoomControls'],
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_control'],
'eval' => array(
'mandatory' => false,