forked from Snck3rs/contao-leaflet-maps
Validate aliases.
This commit is contained in:
@@ -17,6 +17,7 @@ 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\Dca\Validator;
|
||||
use Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices;
|
||||
use Netzmacht\Contao\Leaflet\Frontend\MapElement;
|
||||
use Netzmacht\Contao\Leaflet\Frontend\MapModule;
|
||||
@@ -226,6 +227,19 @@ $container['leaflet.dca.frontend-integration'] = $container->share(
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Validator helper class.
|
||||
*
|
||||
* @return Validator
|
||||
*/
|
||||
$container['leaflet.dca.validator'] = $container->share(
|
||||
function ($container) {
|
||||
return new Validator(
|
||||
$container[Services::TRANSLATOR]
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Component factory for content element.
|
||||
*
|
||||
|
||||
@@ -169,6 +169,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
|
||||
['title'],
|
||||
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
|
||||
),
|
||||
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
|
||||
),
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
|
||||
@@ -180,6 +180,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
|
||||
['title'],
|
||||
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
|
||||
),
|
||||
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
|
||||
),
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
|
||||
@@ -267,6 +267,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
|
||||
['title'],
|
||||
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
|
||||
),
|
||||
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
|
||||
),
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
|
||||
@@ -169,6 +169,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
|
||||
['title'],
|
||||
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
|
||||
),
|
||||
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias')
|
||||
),
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
|
||||
@@ -178,6 +178,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
|
||||
['title'],
|
||||
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
|
||||
),
|
||||
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
|
||||
),
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
|
||||
@@ -166,6 +166,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
|
||||
['title'],
|
||||
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
|
||||
),
|
||||
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
|
||||
),
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
|
||||
@@ -159,6 +159,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
|
||||
['title'],
|
||||
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
|
||||
),
|
||||
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
|
||||
),
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
|
||||
@@ -204,6 +204,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
|
||||
['title'],
|
||||
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
|
||||
),
|
||||
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
|
||||
),
|
||||
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
|
||||
'sql' => "varchar(255) NOT NULL default ''"
|
||||
|
||||
@@ -45,3 +45,5 @@ $GLOBALS['TL_LANG']['leaflet_vector']['rectangle'][1] = 'Rectangle overlay. For
|
||||
|
||||
$GLOBALS['TL_LANG']['leaflet']['searchPosition'] = 'Search location';
|
||||
$GLOBALS['TL_LANG']['leaflet']['applyPosition'] = 'Apply position';
|
||||
|
||||
$GLOBALS['TL_LANG']['leaflet']['invalidAlias'] = 'Invalid alias given. Alias may not be empty, begin with a numeric value nor contain any special chars (underscore allowed).';
|
||||
|
||||
Reference in New Issue
Block a user