mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2026-03-03 02:28:15 +01:00
Switch to PSR-4.
This commit is contained in:
66
src/Dca/VectorCallbacks.php
Normal file
66
src/Dca/VectorCallbacks.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2014-2016 netzmacht David Molineus
|
||||
* @license LGPL 3.0
|
||||
* @filesource
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Dca;
|
||||
|
||||
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||
|
||||
/**
|
||||
* Helper class for the tl_leaflet_vector dca.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Dca
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param array $row Current data row.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateRow($row)
|
||||
{
|
||||
return sprintf(
|
||||
'%s <span class="tl_gray">(%s)</span>',
|
||||
$row['title'],
|
||||
$this->getFormatter()->formatValue('type', $row['type'])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all styles.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getStyles()
|
||||
{
|
||||
$collection = StyleModel::findAll(array('order' => 'title'));
|
||||
|
||||
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user