Adjust dca files and callbacks to work with toolkit v2.

This commit is contained in:
David Molineus
2016-10-04 16:07:05 +02:00
parent 69e3ea8898
commit f8e28f3299
21 changed files with 290 additions and 142 deletions

View File

@@ -9,12 +9,18 @@
*
*/
use Netzmacht\Contao\Leaflet\Alias\UnderscoreFilter;
use Netzmacht\Contao\Leaflet\Boot;
use Netzmacht\Contao\Leaflet\ContaoAssets;
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\MapService;
use Netzmacht\Contao\Leaflet\ServiceContainer;
use Netzmacht\Contao\Toolkit\Data\Alias\Filter\ExistingAliasFilter;
use Netzmacht\Contao\Toolkit\Data\Alias\Filter\SlugifyFilter;
use Netzmacht\Contao\Toolkit\Data\Alias\Filter\SuffixFilter;
use Netzmacht\Contao\Toolkit\Data\Alias\FilterBasedAliasGenerator;
use Netzmacht\Contao\Toolkit\Data\Alias\Validator\UniqueDatabaseValueValidator;
use Netzmacht\Contao\Toolkit\DependencyInjection\Services;
use Netzmacht\JavascriptBuilder\Builder;
use Netzmacht\JavascriptBuilder\Encoder\ChainEncoder;
@@ -119,3 +125,58 @@ $container['leaflet.frontend.value-filter'] = $container->share(function($contai
$container['leaflet.service-container'] = $container->share(function($container) {
return new ServiceContainer($container);
});
/**
* Leaflet alias generator.
*
* @return \Netzmacht\Contao\Toolkit\Data\Alias\AliasGenerator
*/
$container['leaflet.alias-generator'] = $container->share(
function ($container) {
return function ($dataContainerName, $aliasField, $fields) use ($container) {
$filters = [
new ExistingAliasFilter(),
new SlugifyFilter($fields),
new SuffixFilter(),
new UnderscoreFilter(false)
];
$validator = new UniqueDatabaseValueValidator(
$container[Services::DATABASE_CONNECTION],
$dataContainerName,
$aliasField
);
return new FilterBasedAliasGenerator($filters, $validator, $dataContainerName, $aliasField);
};
}
);
$container['leaflet.dca.map-callbacks'] = $container->share(
function ($container) {
return new \Netzmacht\Contao\Leaflet\Dca\MapCallbacks(
$container[Services::DCA_MANAGER],
$container[Services::DATABASE_CONNECTION]
);
}
);
$container['leaflet.dca.layer-callbacks'] = $container->share(
function ($container) {
return new \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks(
$container[Services::DCA_MANAGER],
$container[Services::DATABASE_CONNECTION],
$GLOBALS['LEAFLET_LAYERS']
);
}
);
$container['leaflet.dca.control-callbacks'] = $container->share(
function ($container) {
return new \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks(
$container[Services::DCA_MANAGER],
$container[Services::DATABASE_CONNECTION]
);
}
);

View File

@@ -70,7 +70,7 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_template'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_template'],
'inputType' => 'select',
'exclude' => true,
'options_callback' => \Netzmacht\Contao\Toolkit\Dca::createGetTemplatesCallback('leaflet_map_js'),
'options_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::getTemplates('leaflet_map_js'),
'eval' => array(
'tl_class' => 'w50',
'chosen' => true,

View File

@@ -38,7 +38,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'flag' => 1,
'sorting' => 2,
'panelLayout' => 'filter,sort;search,limit',
'child_record_callback' => array('Netzmacht\Contao\Leaflet\Dca\Control', 'generateRow'),
'child_record_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('generateRow'),
),
'label' => array
(
@@ -81,10 +81,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'tl_leaflet_control',
'active'
)
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton('tl_leaflet_control', 'active')
),
'show' => array
(
@@ -166,7 +163,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_control', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_control',
'alias',
['title'],
'leaflet.alias-generator'
),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
@@ -267,10 +269,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'exclude' => true,
'inputType' => 'multiColumnWizard',
'load_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Control', 'loadLayerRelations'),
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('loadLayerRelations'),
),
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Control', 'saveLayerRelations'),
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('saveLayerRelations'),
),
'eval' => array
(
@@ -282,7 +284,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['layer'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('getLayers'),
'eval' => array(
'style' => 'width: 300px',
'chosen' => true,
@@ -369,7 +371,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Control', 'getZoomControls'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('getZoomControls'),
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_control'],
'eval' => array(
'mandatory' => false,

View File

@@ -96,7 +96,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_icon',
'active'
)
@@ -174,7 +174,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_icon', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_icon',
'alias',
['title'],
'leaflet.alias-generator'
),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
@@ -265,7 +270,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
),
'eval' => array(
'maxlength' => 255,
@@ -280,7 +285,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
),
'eval' => array(
'maxlength' => 255,
@@ -295,7 +300,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
),
'eval' => array(
'maxlength' => 255,

View File

@@ -16,7 +16,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'enableVersioning' => true,
'ctable' => array('tl_leaflet_vector', 'tl_leaflet_marker'),
'ondelete_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Layer', 'deleteRelations'),
\Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('deleteRelations'),
),
'sql' => array
(
@@ -42,13 +42,13 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'flag' => 1,
'icon' => 'system/modules/leaflet/assets/img/layers.png',
'panelLayout' => 'filter;search,limit',
'paste_button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getPasteButtons'),
'paste_button_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getPasteButtons'),
),
'label' => array
(
'fields' => array('title'),
'format' => '%s',
'label_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateRow')
'label_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateRow')
),
'global_operations' => array
(
@@ -88,14 +88,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['markers'],
'href' => 'table=tl_leaflet_marker',
'icon' => 'edit.gif',
'button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateMarkersButton'),
'button_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateMarkersButton')
),
'vectors' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['vectors'],
'href' => 'table=tl_leaflet_vector',
'icon' => 'edit.gif',
'button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateVectorsButton'),
'button_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateVectorsButton'),
),
'edit' => array
(
@@ -128,10 +128,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_layer',
'active'
)
),
),
'show' => array
(
@@ -261,7 +261,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_layer', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_layer',
'alias',
['title'],
'leaflet.alias-generator'
),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
@@ -317,7 +322,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'submitOnChange' => true,
'chosen' => false,
),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getVariants'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getVariants'),
'sql' => "varchar(32) NOT NULL default ''"
),
'tile_provider_key' => array
@@ -366,7 +371,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getLayers'),
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
@@ -462,7 +467,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['disableClusteringAtZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
'default' => '',
'eval' => array(
'maxlength' => 4,
@@ -542,7 +547,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['boundsMode'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getBoundsModes'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getBoundsModes'),
'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true),
'sql' => "varchar(6) NOT NULL default ''"
),

View File

@@ -163,7 +163,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_map', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_map',
'alias',
['title'],
'leaflet.alias-generator'
),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
@@ -174,10 +179,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
),
'wizard' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getGeocoder')
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getGeocoder')
),
'eval' => array(
'maxlength' => 255,
@@ -192,10 +197,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'exclude' => true,
'inputType' => 'multiColumnWizard',
'load_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Map', 'loadLayerRelations'),
\Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('loadLayerRelations'),
),
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Map', 'saveLayerRelations'),
\Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('saveLayerRelations'),
),
'eval' => array(
'multiple' => true,
@@ -206,7 +211,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['reference'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('getLayers'),
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
@@ -226,7 +231,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['zoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
'default' => '',
'eval' => array(
'maxlength' => 4,
@@ -251,7 +256,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['minZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',
@@ -266,7 +271,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['maxZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',
@@ -497,7 +502,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['locateMaxZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',

View File

@@ -40,7 +40,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'flag' => 1,
'panelLayout' => 'sort,filter;search,limit',
'headerFields' => array('title', 'type'),
'child_record_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'generateRow'),
'child_record_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'generateRow'),
),
'label' => array
(
@@ -97,7 +97,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_marker',
'active'
)
@@ -172,7 +172,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_marker', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_marker',
'alias',
['title'],
'leaflet.alias-generator'
),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
@@ -183,14 +188,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate'),
array('Netzmacht\Contao\Leaflet\Dca\Marker', 'saveCoordinates')
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate'),
array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'saveCoordinates')
),
'load_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Marker', 'loadCoordinates')
array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'loadCoordinates')
),
'wizard' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getGeocoder')
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getGeocoder')
),
'eval' => array(
'maxlength' => 255,
@@ -264,7 +269,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['popup'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'getPopups'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getPopups'),
'eval' => array(
'mandatory' => false,
'tl_class' => 'w50',
@@ -295,7 +300,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'getIcons'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getIcons'),
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',

View File

@@ -96,7 +96,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_popup',
'active'
)
@@ -160,7 +160,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_popup', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_popup',
'alias',
['title'],
'leaflet.alias-generator'
),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
@@ -225,7 +230,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
),
'eval' => array(
'maxlength' => 255,

View File

@@ -95,7 +95,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_style',
'active'
)
@@ -153,7 +153,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_style', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_style',
'alias',
['title'],
'leaflet.alias-generator'
),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
@@ -189,7 +194,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'exclude' => true,
'inputType' => 'text',
'wizard' => array(
\Netzmacht\Contao\Toolkit\Dca::createColorPickerCallback(),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::colorPicker()
),
'eval' => array(
'tl_class' => 'w50 wizard clr',
@@ -230,7 +235,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'exclude' => true,
'inputType' => 'text',
'wizard' => array(
\Netzmacht\Contao\Toolkit\Dca::createColorPickerCallback(),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::colorPicker()
),
'eval' => array(
'tl_class' => 'clr w50 wizard',

View File

@@ -104,7 +104,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_vector',
'active'
)
@@ -198,7 +198,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_vector', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_vector',
'alias',
['title'],
'leaflet.alias-generator'
),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"

View File

@@ -70,7 +70,7 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_template'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_template'],
'inputType' => 'select',
'exclude' => true,
'options_callback' => \Netzmacht\Contao\Toolkit\Dca::createGetTemplatesCallback('leaflet_map_js'),
'options_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::getTemplates('leaflet_map_js'),
'eval' => array(
'tl_class' => 'w50',
'chosen' => true,