mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-01 20:43:52 +01:00
Add getIcons callback to the layer dca listener.
This commit is contained in:
@@ -17,6 +17,7 @@ use Contao\Image;
|
|||||||
use Contao\StringUtil;
|
use Contao\StringUtil;
|
||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
use Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer\LayerLabelRenderer;
|
use Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer\LayerLabelRenderer;
|
||||||
|
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
|
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||||
@@ -373,6 +374,24 @@ class LayerDcaListener extends AbstractListener
|
|||||||
return $this->amenities;
|
return $this->amenities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all icons.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getIcons()
|
||||||
|
{
|
||||||
|
$collection = IconModel::findAll(array('order' => 'title'));
|
||||||
|
$builder = OptionsBuilder::fromCollection(
|
||||||
|
$collection,
|
||||||
|
function ($model) {
|
||||||
|
return sprintf('%s [%s]', $model['title'], $model['type']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return $builder->getOptions();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a button.
|
* Generate a button.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -803,7 +803,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['amenityIcons'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['amenityIcons'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'multiColumnWizard',
|
'inputType' => 'multiColumnWizard',
|
||||||
'options_callback' => ['Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getIcons'],
|
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.layer', 'getIcons'],
|
||||||
'eval' => [
|
'eval' => [
|
||||||
'columnFields' => [
|
'columnFields' => [
|
||||||
'amenity' => [
|
'amenity' => [
|
||||||
@@ -822,7 +822,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['amenityIcon'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['amenityIcon'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => ['Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getIcons'],
|
'options_callback' => ['netzmacht.contao_leaflet_maps.listeners.dca.layer', 'getIcons'],
|
||||||
'eval' => [
|
'eval' => [
|
||||||
'mandatory' => true,
|
'mandatory' => true,
|
||||||
'tl_class' => 'w50',
|
'tl_class' => 'w50',
|
||||||
|
|||||||
Reference in New Issue
Block a user