mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-30 12:03:44 +01:00
Format vector type.
This commit is contained in:
@@ -18,6 +18,7 @@ use Netzmacht\Contao\Leaflet\Dca\FrontendIntegration;
|
|||||||
use Netzmacht\Contao\Leaflet\Dca\LayerCallbacks;
|
use Netzmacht\Contao\Leaflet\Dca\LayerCallbacks;
|
||||||
use Netzmacht\Contao\Leaflet\Dca\MapCallbacks;
|
use Netzmacht\Contao\Leaflet\Dca\MapCallbacks;
|
||||||
use Netzmacht\Contao\Leaflet\Dca\Validator;
|
use Netzmacht\Contao\Leaflet\Dca\Validator;
|
||||||
|
use Netzmacht\Contao\Leaflet\Dca\VectorCallbacks;
|
||||||
use Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices;
|
use Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices;
|
||||||
use Netzmacht\Contao\Leaflet\Frontend\MapElement;
|
use Netzmacht\Contao\Leaflet\Frontend\MapElement;
|
||||||
use Netzmacht\Contao\Leaflet\Frontend\MapModule;
|
use Netzmacht\Contao\Leaflet\Frontend\MapModule;
|
||||||
@@ -214,6 +215,17 @@ $container['leaflet.dca.control-callbacks'] = $container->share(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback helper class for tl_leaflet_control.
|
||||||
|
*
|
||||||
|
* @return ControlCallbacks
|
||||||
|
*/
|
||||||
|
$container['leaflet.dca.vector-callbacks'] = $container->share(
|
||||||
|
function ($container) {
|
||||||
|
return new VectorCallbacks($container[Services::DCA_MANAGER]);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback helper class for frontend integration.
|
* Callback helper class for frontend integration.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = 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\VectorCallbacks', 'generateRow'),
|
'child_record_callback' => Netzmacht\Contao\Leaflet\Dca\VectorCallbacks::callback('generateRow'),
|
||||||
),
|
),
|
||||||
'label' => array
|
'label' => array
|
||||||
(
|
(
|
||||||
@@ -279,7 +279,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
|
|||||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['style'],
|
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['style'],
|
||||||
'exclude' => true,
|
'exclude' => true,
|
||||||
'inputType' => 'select',
|
'inputType' => 'select',
|
||||||
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\VectorCallbacks', 'getStyles'),
|
'options_callback' => Netzmacht\Contao\Leaflet\Dca\VectorCallbacks::callback('getStyles'),
|
||||||
'eval' => array(
|
'eval' => array(
|
||||||
'mandatory' => false,
|
'mandatory' => false,
|
||||||
'tl_class' => 'w50',
|
'tl_class' => 'w50',
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||||
|
|
||||||
|
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
|
||||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||||
|
|
||||||
@@ -19,8 +20,22 @@ use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
|||||||
*
|
*
|
||||||
* @package Netzmacht\Contao\Leaflet\Dca
|
* @package Netzmacht\Contao\Leaflet\Dca
|
||||||
*/
|
*/
|
||||||
class VectorCallbacks
|
class VectorCallbacks extends Callbacks
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Name of the data container.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $name = 'tl_leaflet_vector';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper service name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected static $serviceName = 'leaflet.dca.vector-callbacks';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the row label.
|
* Generate the row label.
|
||||||
*
|
*
|
||||||
@@ -30,7 +45,12 @@ class VectorCallbacks
|
|||||||
*/
|
*/
|
||||||
public function generateRow($row)
|
public function generateRow($row)
|
||||||
{
|
{
|
||||||
return sprintf('%s <span class="tl_gray">[%s]</span>', $row['title'], $row['type']);
|
return sprintf(
|
||||||
|
'%s <span class="tl_gray">%s (%s)</span>',
|
||||||
|
$row['title'],
|
||||||
|
$row['alias'],
|
||||||
|
$this->getFormatter()->formatValue('type', $row['type'])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user