Fix controls selection.

This commit is contained in:
David Molineus
2017-10-09 15:39:50 +02:00
parent edf212b850
commit 51fc784800
3 changed files with 30 additions and 10 deletions

View File

@@ -41,17 +41,36 @@ class ControlDcaListener extends AbstractListener
*/
private $connection;
/**
* Control types.
*
* @var array
*/
private $types;
/**
* Construct.
*
* @param Manager $manager Data container manager.
* @param Connection $connection Database connection.
* @param array $types Control types.
*/
public function __construct(Manager $manager, Connection $connection)
public function __construct(Manager $manager, Connection $connection, array $types)
{
parent::__construct($manager);
$this->connection = $connection;
$this->types = $types;
}
/**
* Get control types.
*
* @return array
*/
public function getControlTypes(): array
{
return $this->types;
}
/**

View File

@@ -26,6 +26,7 @@ services:
arguments:
- '@netzmacht.contao_toolkit.dca.manager'
- '@database_connection'
- '%netzmacht.contao_leaflet_maps.controls%'
netzmacht.contao_leaflet_maps.listeners.dca.layer:
class: Netzmacht\Contao\Leaflet\Listener\Dca\LayerDcaListener

View File

@@ -196,12 +196,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
),
'type' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['type'],
'exclude' => true,
'inputType' => 'select',
'filter' => true,
'sorting' => true,
'eval' => array(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['type'],
'exclude' => true,
'inputType' => 'select',
'filter' => true,
'sorting' => true,
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
'includeBlankOption' => true,
@@ -209,9 +209,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'chosen' => true,
'helpwizard' => true,
),
'options' => $GLOBALS['LEAFLET_CONTROLS'],
'reference' => &$GLOBALS['TL_LANG']['leaflet_control'],
'sql' => "varchar(32) NOT NULL default ''"
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.control', 'getControlTypes'],
'reference' => &$GLOBALS['TL_LANG']['leaflet_control'],
'sql' => "varchar(32) NOT NULL default ''",
),
'position' => array
(