Files
contao-leaflet-maps/src/Netzmacht/Contao/Leaflet/Dca/Vector.php

48 lines
994 B
PHP
Raw Normal View History

2015-01-07 17:59:56 +01:00
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Dca;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
2015-01-09 11:53:58 +01:00
use Netzmacht\Contao\Leaflet\Model\StyleModel;
2015-01-12 19:03:29 +01:00
/**
* Helper class for the tl_leaflet_vector dca.
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
2015-01-07 17:59:56 +01:00
class Vector
{
2015-01-12 19:03:29 +01:00
/**
* Generate the row label.
*
* @param array $row Current data row.
*
* @return string
*/
2015-01-07 17:59:56 +01:00
public function generateRow($row)
{
return sprintf('%s <span class="tl_gray">[%s]</span>', $row['title'], $row['type']);
}
2015-01-09 11:53:58 +01:00
/**
* Get all styles.
*
* @return array
*/
public function getStyles()
{
$collection = StyleModel::findAll(array('order' => 'title'));
return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions();
}
2015-01-07 17:59:56 +01:00
}