forked from Snck3rs/contao-leaflet-maps
Adjust dca files and callbacks to work with toolkit v2.
This commit is contained in:
@@ -9,12 +9,18 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Leaflet\Alias\UnderscoreFilter;
|
||||||
use Netzmacht\Contao\Leaflet\Boot;
|
use Netzmacht\Contao\Leaflet\Boot;
|
||||||
use Netzmacht\Contao\Leaflet\ContaoAssets;
|
use Netzmacht\Contao\Leaflet\ContaoAssets;
|
||||||
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
|
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
use Netzmacht\Contao\Leaflet\MapService;
|
use Netzmacht\Contao\Leaflet\MapService;
|
||||||
use Netzmacht\Contao\Leaflet\ServiceContainer;
|
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\Contao\Toolkit\DependencyInjection\Services;
|
||||||
use Netzmacht\JavascriptBuilder\Builder;
|
use Netzmacht\JavascriptBuilder\Builder;
|
||||||
use Netzmacht\JavascriptBuilder\Encoder\ChainEncoder;
|
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) {
|
$container['leaflet.service-container'] = $container->share(function($container) {
|
||||||
return new ServiceContainer($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]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_template'] = array(
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_template'],
|
'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_template'],
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'exclude' => true,
|
'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(
|
'eval' => array(
|
||||||
'tl_class' => 'w50',
|
'tl_class' => 'w50',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
|||||||
'flag' => 1,
|
'flag' => 1,
|
||||||
'sorting' => 2,
|
'sorting' => 2,
|
||||||
'panelLayout' => 'filter,sort;search,limit',
|
'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
|
'label' => array
|
||||||
(
|
(
|
||||||
@@ -81,10 +81,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['toggle'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['toggle'],
|
||||||
'icon' => 'visible.gif',
|
'icon' => 'visible.gif',
|
||||||
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
|
'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_control', 'active')
|
||||||
'tl_leaflet_control',
|
|
||||||
'active'
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
'show' => array
|
'show' => array
|
||||||
(
|
(
|
||||||
@@ -166,7 +163,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
|||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'search' => true,
|
'search' => true,
|
||||||
'save_callback' => array(
|
'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),
|
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||||
'sql' => "varchar(255) NOT NULL default ''"
|
'sql' => "varchar(255) NOT NULL default ''"
|
||||||
@@ -267,10 +269,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'multiColumnWizard',
|
'inputType' => 'multiColumnWizard',
|
||||||
'load_callback' => array(
|
'load_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Control', 'loadLayerRelations'),
|
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('loadLayerRelations'),
|
||||||
),
|
),
|
||||||
'save_callback' => array(
|
'save_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Control', 'saveLayerRelations'),
|
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('saveLayerRelations'),
|
||||||
),
|
),
|
||||||
'eval' => array
|
'eval' => array
|
||||||
(
|
(
|
||||||
@@ -282,7 +284,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['layer'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['layer'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
|
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('getLayers'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'style' => 'width: 300px',
|
'style' => 'width: 300px',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
@@ -369,7 +371,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'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'],
|
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_control'],
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'mandatory' => false,
|
'mandatory' => false,
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['toggle'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['toggle'],
|
||||||
'icon' => 'visible.gif',
|
'icon' => 'visible.gif',
|
||||||
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
|
'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',
|
'tl_leaflet_icon',
|
||||||
'active'
|
'active'
|
||||||
)
|
)
|
||||||
@@ -174,7 +174,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'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),
|
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||||
'sql' => "varchar(255) NOT NULL default ''"
|
'sql' => "varchar(255) NOT NULL default ''"
|
||||||
@@ -265,7 +270,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'save_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
|
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 255,
|
'maxlength' => 255,
|
||||||
@@ -280,7 +285,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'save_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
|
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 255,
|
'maxlength' => 255,
|
||||||
@@ -295,7 +300,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'save_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
|
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 255,
|
'maxlength' => 255,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'enableVersioning' => true,
|
'enableVersioning' => true,
|
||||||
'ctable' => array('tl_leaflet_vector', 'tl_leaflet_marker'),
|
'ctable' => array('tl_leaflet_vector', 'tl_leaflet_marker'),
|
||||||
'ondelete_callback' => array(
|
'ondelete_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Layer', 'deleteRelations'),
|
\Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('deleteRelations'),
|
||||||
),
|
),
|
||||||
'sql' => array
|
'sql' => array
|
||||||
(
|
(
|
||||||
@@ -42,13 +42,13 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'flag' => 1,
|
'flag' => 1,
|
||||||
'icon' => 'system/modules/leaflet/assets/img/layers.png',
|
'icon' => 'system/modules/leaflet/assets/img/layers.png',
|
||||||
'panelLayout' => 'filter;search,limit',
|
'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
|
'label' => array
|
||||||
(
|
(
|
||||||
'fields' => array('title'),
|
'fields' => array('title'),
|
||||||
'format' => '%s',
|
'format' => '%s',
|
||||||
'label_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateRow')
|
'label_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateRow')
|
||||||
),
|
),
|
||||||
'global_operations' => array
|
'global_operations' => array
|
||||||
(
|
(
|
||||||
@@ -88,14 +88,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['markers'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['markers'],
|
||||||
'href' => 'table=tl_leaflet_marker',
|
'href' => 'table=tl_leaflet_marker',
|
||||||
'icon' => 'edit.gif',
|
'icon' => 'edit.gif',
|
||||||
'button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateMarkersButton'),
|
'button_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateMarkersButton')
|
||||||
),
|
),
|
||||||
'vectors' => array
|
'vectors' => array
|
||||||
(
|
(
|
||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['vectors'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['vectors'],
|
||||||
'href' => 'table=tl_leaflet_vector',
|
'href' => 'table=tl_leaflet_vector',
|
||||||
'icon' => 'edit.gif',
|
'icon' => 'edit.gif',
|
||||||
'button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateVectorsButton'),
|
'button_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateVectorsButton'),
|
||||||
),
|
),
|
||||||
'edit' => array
|
'edit' => array
|
||||||
(
|
(
|
||||||
@@ -128,10 +128,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'],
|
||||||
'icon' => 'visible.gif',
|
'icon' => 'visible.gif',
|
||||||
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
|
'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',
|
'tl_leaflet_layer',
|
||||||
'active'
|
'active'
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
'show' => array
|
'show' => array
|
||||||
(
|
(
|
||||||
@@ -261,7 +261,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'search' => true,
|
'search' => true,
|
||||||
'save_callback' => array(
|
'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),
|
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||||
'sql' => "varchar(255) NOT NULL default ''"
|
'sql' => "varchar(255) NOT NULL default ''"
|
||||||
@@ -317,7 +322,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'submitOnChange' => true,
|
'submitOnChange' => true,
|
||||||
'chosen' => false,
|
'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 ''"
|
'sql' => "varchar(32) NOT NULL default ''"
|
||||||
),
|
),
|
||||||
'tile_provider_key' => array
|
'tile_provider_key' => array
|
||||||
@@ -366,7 +371,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
|
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getLayers'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'mandatory' => true,
|
'mandatory' => true,
|
||||||
'tl_class' => 'w50',
|
'tl_class' => 'w50',
|
||||||
@@ -462,7 +467,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['disableClusteringAtZoom'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['disableClusteringAtZoom'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
|
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 4,
|
'maxlength' => 4,
|
||||||
@@ -542,7 +547,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['boundsMode'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['boundsMode'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'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),
|
'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true),
|
||||||
'sql' => "varchar(6) NOT NULL default ''"
|
'sql' => "varchar(6) NOT NULL default ''"
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -163,7 +163,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
|||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'search' => true,
|
'search' => true,
|
||||||
'save_callback' => array(
|
'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),
|
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||||
'sql' => "varchar(255) NOT NULL default ''"
|
'sql' => "varchar(255) NOT NULL default ''"
|
||||||
@@ -174,10 +179,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'save_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
|
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
|
||||||
),
|
),
|
||||||
'wizard' => array(
|
'wizard' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getGeocoder')
|
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getGeocoder')
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 255,
|
'maxlength' => 255,
|
||||||
@@ -192,10 +197,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'multiColumnWizard',
|
'inputType' => 'multiColumnWizard',
|
||||||
'load_callback' => array(
|
'load_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Map', 'loadLayerRelations'),
|
\Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('loadLayerRelations'),
|
||||||
),
|
),
|
||||||
'save_callback' => array(
|
'save_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Map', 'saveLayerRelations'),
|
\Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('saveLayerRelations'),
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
@@ -206,7 +211,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['reference'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['reference'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
|
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('getLayers'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'mandatory' => true,
|
'mandatory' => true,
|
||||||
'tl_class' => 'w50',
|
'tl_class' => 'w50',
|
||||||
@@ -226,7 +231,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['zoom'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['zoom'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
|
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 4,
|
'maxlength' => 4,
|
||||||
@@ -251,7 +256,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['minZoom'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['minZoom'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
|
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 4,
|
'maxlength' => 4,
|
||||||
'rgxp' => 'digit',
|
'rgxp' => 'digit',
|
||||||
@@ -266,7 +271,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['maxZoom'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['maxZoom'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
|
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 4,
|
'maxlength' => 4,
|
||||||
'rgxp' => 'digit',
|
'rgxp' => 'digit',
|
||||||
@@ -497,7 +502,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['locateMaxZoom'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['locateMaxZoom'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
|
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getZoomLevels'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 4,
|
'maxlength' => 4,
|
||||||
'rgxp' => 'digit',
|
'rgxp' => 'digit',
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
|
|||||||
'flag' => 1,
|
'flag' => 1,
|
||||||
'panelLayout' => 'sort,filter;search,limit',
|
'panelLayout' => 'sort,filter;search,limit',
|
||||||
'headerFields' => array('title', 'type'),
|
'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
|
'label' => array
|
||||||
(
|
(
|
||||||
@@ -97,7 +97,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['toggle'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['toggle'],
|
||||||
'icon' => 'visible.gif',
|
'icon' => 'visible.gif',
|
||||||
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
|
'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',
|
'tl_leaflet_marker',
|
||||||
'active'
|
'active'
|
||||||
)
|
)
|
||||||
@@ -172,7 +172,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
|
|||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'search' => true,
|
'search' => true,
|
||||||
'save_callback' => array(
|
'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),
|
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||||
'sql' => "varchar(255) NOT NULL default ''"
|
'sql' => "varchar(255) NOT NULL default ''"
|
||||||
@@ -183,14 +188,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'save_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate'),
|
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate'),
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Marker', 'saveCoordinates')
|
array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'saveCoordinates')
|
||||||
),
|
),
|
||||||
'load_callback' => array(
|
'load_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Marker', 'loadCoordinates')
|
array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'loadCoordinates')
|
||||||
),
|
),
|
||||||
'wizard' => array(
|
'wizard' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getGeocoder')
|
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'getGeocoder')
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 255,
|
'maxlength' => 255,
|
||||||
@@ -264,7 +269,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['popup'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['popup'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'getPopups'),
|
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getPopups'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'mandatory' => false,
|
'mandatory' => false,
|
||||||
'tl_class' => 'w50',
|
'tl_class' => 'w50',
|
||||||
@@ -295,7 +300,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'getIcons'),
|
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getIcons'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'mandatory' => true,
|
'mandatory' => true,
|
||||||
'tl_class' => 'w50',
|
'tl_class' => 'w50',
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'],
|
||||||
'icon' => 'visible.gif',
|
'icon' => 'visible.gif',
|
||||||
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
|
'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',
|
'tl_leaflet_popup',
|
||||||
'active'
|
'active'
|
||||||
)
|
)
|
||||||
@@ -160,7 +160,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'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),
|
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||||
'sql' => "varchar(255) NOT NULL default ''"
|
'sql' => "varchar(255) NOT NULL default ''"
|
||||||
@@ -225,7 +230,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'save_callback' => array(
|
||||||
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
|
array('Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks', 'validateCoordinate')
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'maxlength' => 255,
|
'maxlength' => 255,
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['toggle'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['toggle'],
|
||||||
'icon' => 'visible.gif',
|
'icon' => 'visible.gif',
|
||||||
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
|
'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',
|
'tl_leaflet_style',
|
||||||
'active'
|
'active'
|
||||||
)
|
)
|
||||||
@@ -153,7 +153,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'save_callback' => array(
|
'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),
|
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||||
'sql' => "varchar(255) NOT NULL default ''"
|
'sql' => "varchar(255) NOT NULL default ''"
|
||||||
@@ -189,7 +194,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'wizard' => array(
|
'wizard' => array(
|
||||||
\Netzmacht\Contao\Toolkit\Dca::createColorPickerCallback(),
|
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::colorPicker()
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'tl_class' => 'w50 wizard clr',
|
'tl_class' => 'w50 wizard clr',
|
||||||
@@ -230,7 +235,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
|
|||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'wizard' => array(
|
'wizard' => array(
|
||||||
\Netzmacht\Contao\Toolkit\Dca::createColorPickerCallback(),
|
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::colorPicker()
|
||||||
),
|
),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'tl_class' => 'clr w50 wizard',
|
'tl_class' => 'clr w50 wizard',
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'],
|
||||||
'icon' => 'visible.gif',
|
'icon' => 'visible.gif',
|
||||||
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
|
'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',
|
'tl_leaflet_vector',
|
||||||
'active'
|
'active'
|
||||||
)
|
)
|
||||||
@@ -198,7 +198,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
|
|||||||
'inputType' => 'text',
|
'inputType' => 'text',
|
||||||
'search' => true,
|
'search' => true,
|
||||||
'save_callback' => array(
|
'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),
|
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||||
'sql' => "varchar(255) NOT NULL default ''"
|
'sql' => "varchar(255) NOT NULL default ''"
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_template'] = array(
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_template'],
|
'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_template'],
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'exclude' => true,
|
'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(
|
'eval' => array(
|
||||||
'tl_class' => 'w50',
|
'tl_class' => 'w50',
|
||||||
'chosen' => true,
|
'chosen' => true,
|
||||||
|
|||||||
37
src/Netzmacht/Contao/Leaflet/Alias/UnderscoreFilter.php
Normal file
37
src/Netzmacht/Contao/Leaflet/Alias/UnderscoreFilter.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package netzmacht
|
||||||
|
* @author David Molineus <david.molineus@netzmacht.de>
|
||||||
|
* @copyright 2016 netzmacht David Molineus. All rights reserved.
|
||||||
|
* @filesource
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Netzmacht\Contao\Leaflet\Alias;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Toolkit\Data\Alias\Filter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UnderscoreFilter
|
||||||
|
*
|
||||||
|
* @package Netzmacht\Contao\Leaflet\Alias
|
||||||
|
*/
|
||||||
|
class UnderscoreFilter extends Filter\AbstractFilter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function repeatUntilValid()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function apply($model, $value, $separator)
|
||||||
|
{
|
||||||
|
return str_replace('-', '_', $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,8 +11,9 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
|
||||||
|
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||||
use Netzmacht\Contao\Toolkit\ServiceContainerTrait;
|
|
||||||
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
use Netzmacht\Contao\Leaflet\Model\ControlModel;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
|
|
||||||
@@ -21,9 +22,21 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
|||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet\Dca
|
* @package Netzmacht\Contao\Leaflet\Dca
|
||||||
*/
|
*/
|
||||||
class Control
|
class ControlCallbacks extends Callbacks
|
||||||
{
|
{
|
||||||
use ServiceContainerTrait;
|
/**
|
||||||
|
* Name of the data container.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $name = 'tl_leaflet_control';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper service name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $serviceName = 'leaflet.dca.control-callbacks';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The database connection.
|
* The database connection.
|
||||||
@@ -34,10 +47,15 @@ class Control
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param Manager $manager Data container manager.
|
||||||
|
* @param \Database $database Database connection.
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct(Manager $manager, \Database $database)
|
||||||
{
|
{
|
||||||
$this->database = static::getServiceContainer()->getDatabaseConnection();
|
parent::__construct($manager);
|
||||||
|
|
||||||
|
$this->database = $database;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +102,7 @@ class Control
|
|||||||
{
|
{
|
||||||
$collection = ControlModel::findBy('type', 'zoom', array('order' => 'title'));
|
$collection = ControlModel::findBy('type', 'zoom', array('order' => 'title'));
|
||||||
|
|
||||||
return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions();
|
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@ class FrontendIntegration
|
|||||||
{
|
{
|
||||||
$collection = MapModel::findAll();
|
$collection = MapModel::findAll();
|
||||||
|
|
||||||
return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions();
|
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @package dev
|
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
|
||||||
* @copyright 2015 netzmacht creative David Molineus
|
|
||||||
* @license LGPL 3.0
|
|
||||||
* @filesource
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
|
||||||
|
|
||||||
use Netzmacht\Contao\Toolkit\Dca;
|
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Callback\GenerateAliasCallback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper class for dca functions.
|
|
||||||
*
|
|
||||||
* @package Netzmacht\Contao\Leaflet\Dca
|
|
||||||
*/
|
|
||||||
class Helper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Generate an alias callback which creates a valid javascript var name.
|
|
||||||
*
|
|
||||||
* @param string $table The table.
|
|
||||||
* @param string $column The value column.
|
|
||||||
*
|
|
||||||
* @return GenerateAliasCallback
|
|
||||||
*/
|
|
||||||
public static function createGenerateAliasCallback($table, $column)
|
|
||||||
{
|
|
||||||
$callback = Dca::createGenerateAliasCallback($table, $column);
|
|
||||||
$callback->getGenerator()->addFilter(
|
|
||||||
function ($value) {
|
|
||||||
return str_replace('-', '_', $value);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return $callback;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,8 +11,9 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
|
||||||
|
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||||
use Netzmacht\Contao\Toolkit\ServiceContainerTrait;
|
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,9 +21,21 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
|||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet\Dca
|
* @package Netzmacht\Contao\Leaflet\Dca
|
||||||
*/
|
*/
|
||||||
class Layer
|
class LayerCallbacks extends Callbacks
|
||||||
{
|
{
|
||||||
use ServiceContainerTrait;
|
/**
|
||||||
|
* Name of the data container.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $name = 'tl_leaflet_layer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper service name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $serviceName = 'leaflet.dca.layer-callbacks';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layers definition.
|
* Layers definition.
|
||||||
@@ -41,12 +54,18 @@ class Layer
|
|||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
*
|
*
|
||||||
|
* @param Manager $manager Data container manager.
|
||||||
|
* @param \Database $database Database connection.
|
||||||
|
* @param array $layers Leaflet layer configuration.
|
||||||
|
*
|
||||||
* @SuppressWarnings(PHPMD.Superglobals)
|
* @SuppressWarnings(PHPMD.Superglobals)
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct(Manager $manager, \Database $database, array $layers)
|
||||||
{
|
{
|
||||||
$this->layers = &$GLOBALS['LEAFLET_LAYERS'];
|
parent::__construct($manager);
|
||||||
$this->database = static::getServiceContainer()->getDatabaseConnection();
|
|
||||||
|
$this->layers = $layers;
|
||||||
|
$this->database = $database;
|
||||||
|
|
||||||
\Controller::loadLanguageFile('leaflet_layer');
|
\Controller::loadLanguageFile('leaflet_layer');
|
||||||
|
|
||||||
@@ -237,22 +256,6 @@ class Layer
|
|||||||
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
|
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all layers except of the current layer.
|
|
||||||
*
|
|
||||||
* @param \DataContainer $dataContainer The dataContainer driver.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getLayers($dataContainer)
|
|
||||||
{
|
|
||||||
$collection = LayerModel::findBy('id !', $dataContainer->id);
|
|
||||||
|
|
||||||
return OptionsBuilder::fromCollection($collection, 'id', 'title')
|
|
||||||
->asTree()
|
|
||||||
->getOptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the relations when the layer is deleted.
|
* Delete the relations when the layer is deleted.
|
||||||
*
|
*
|
||||||
@@ -22,7 +22,7 @@ use Netzmacht\LeafletPHP\Value\LatLng;
|
|||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet\Dca
|
* @package Netzmacht\Contao\Leaflet\Dca
|
||||||
*/
|
*/
|
||||||
class Leaflet
|
class LeafletCallbacks
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Validate a coordinate.
|
* Validate a coordinate.
|
||||||
@@ -11,16 +11,31 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||||
|
|
||||||
use Netzmacht\Contao\Toolkit\ServiceContainerTrait;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
|
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
|
||||||
|
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||||
|
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Map is the helper class for the tl_leaflet_map dca.
|
* Class Map is the helper class for the tl_leaflet_map dca.
|
||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet\Dca
|
* @package Netzmacht\Contao\Leaflet\Dca
|
||||||
*/
|
*/
|
||||||
class Map
|
class MapCallbacks extends Callbacks
|
||||||
{
|
{
|
||||||
use ServiceContainerTrait;
|
/**
|
||||||
|
* Name of the data container.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $name = 'tl_leaflet_map';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper service name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $serviceName = 'leaflet.dca.map-callbacks';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The database connection.
|
* The database connection.
|
||||||
@@ -31,10 +46,15 @@ class Map
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param Manager $manager Data container manager.
|
||||||
|
* @param \Database $database Database connection.
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct(Manager $manager, \Database $database)
|
||||||
{
|
{
|
||||||
$this->database = static::getServiceContainer()->getDatabaseConnection();
|
parent::__construct($manager);
|
||||||
|
|
||||||
|
$this->database = $database;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,4 +140,20 @@ class Map
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all layers except of the current layer.
|
||||||
|
*
|
||||||
|
* @param \DataContainer $dataContainer The dataContainer driver.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getLayers($dataContainer)
|
||||||
|
{
|
||||||
|
$collection = LayerModel::findBy('id !', $dataContainer->id);
|
||||||
|
|
||||||
|
return OptionsBuilder::fromCollection($collection, 'title')
|
||||||
|
->asTree()
|
||||||
|
->getOptions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
|||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet\Dca
|
* @package Netzmacht\Contao\Leaflet\Dca
|
||||||
*/
|
*/
|
||||||
class Marker
|
class MarkerCallbacks
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Generate the row label.
|
* Generate the row label.
|
||||||
@@ -44,7 +44,6 @@ class Marker
|
|||||||
$collection = IconModel::findAll(array('order' => 'title'));
|
$collection = IconModel::findAll(array('order' => 'title'));
|
||||||
$builder = OptionsBuilder::fromCollection(
|
$builder = OptionsBuilder::fromCollection(
|
||||||
$collection,
|
$collection,
|
||||||
'id',
|
|
||||||
function ($model) {
|
function ($model) {
|
||||||
return sprintf('%s [%s]', $model['title'], $model['type']);
|
return sprintf('%s [%s]', $model['title'], $model['type']);
|
||||||
}
|
}
|
||||||
@@ -61,7 +60,7 @@ class Marker
|
|||||||
public function getPopups()
|
public function getPopups()
|
||||||
{
|
{
|
||||||
$collection = PopupModel::findAll(array('order' => 'title'));
|
$collection = PopupModel::findAll(array('order' => 'title'));
|
||||||
$builder = OptionsBuilder::fromCollection($collection, 'id', 'title');
|
$builder = OptionsBuilder::fromCollection($collection, 'title');
|
||||||
|
|
||||||
return $builder->getOptions();
|
return $builder->getOptions();
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
|||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet\Dca
|
* @package Netzmacht\Contao\Leaflet\Dca
|
||||||
*/
|
*/
|
||||||
class Vector
|
class VectorCallbacks
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Generate the row label.
|
* Generate the row label.
|
||||||
@@ -42,6 +42,6 @@ class Vector
|
|||||||
{
|
{
|
||||||
$collection = StyleModel::findAll(array('order' => 'title'));
|
$collection = StyleModel::findAll(array('order' => 'title'));
|
||||||
|
|
||||||
return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions();
|
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Subscriber;
|
namespace Netzmacht\Contao\Leaflet\Subscriber;
|
||||||
|
|
||||||
use Netzmacht\Contao\Leaflet\Dca\Vector;
|
use Netzmacht\Contao\Leaflet\Dca\VectorCallbacks;
|
||||||
use Netzmacht\Contao\Leaflet\Event\ConvertToGeoJsonEvent;
|
use Netzmacht\Contao\Leaflet\Event\ConvertToGeoJsonEvent;
|
||||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||||
use Netzmacht\LeafletPHP\Value\GeoJson\Feature;
|
use Netzmacht\LeafletPHP\Value\GeoJson\Feature;
|
||||||
@@ -83,7 +83,7 @@ class GeoJsonSubscriber implements EventSubscriberInterface
|
|||||||
$definition = $event->getDefinition();
|
$definition = $event->getDefinition();
|
||||||
$model = $event->getModel();
|
$model = $event->getModel();
|
||||||
|
|
||||||
if (($definition instanceof Marker || $definition instanceof Vector)
|
if (($definition instanceof Marker || $definition instanceof VectorCallbacks)
|
||||||
&& $model instanceof \Model && $feature instanceof Feature) {
|
&& $model instanceof \Model && $feature instanceof Feature) {
|
||||||
$this->setDataProperty($model, $feature);
|
$this->setDataProperty($model, $feature);
|
||||||
$this->setBoundsInformation($model, $feature);
|
$this->setBoundsInformation($model, $feature);
|
||||||
|
|||||||
Reference in New Issue
Block a user