Switch to PSR-4.

This commit is contained in:
David Molineus
2017-10-05 14:16:56 +02:00
parent e3344ffd4f
commit 827c746b0d
87 changed files with 4 additions and 6 deletions

View 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();
}
}