mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2026-01-16 20:35:19 +01:00
Adjust dca files and callbacks to work with toolkit v2.
This commit is contained in:
47
src/Netzmacht/Contao/Leaflet/Dca/VectorCallbacks.php
Normal file
47
src/Netzmacht/Contao/Leaflet/Dca/VectorCallbacks.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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;
|
||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||
|
||||
/**
|
||||
* Helper class for the tl_leaflet_vector dca.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Dca
|
||||
*/
|
||||
class VectorCallbacks
|
||||
{
|
||||
/**
|
||||
* 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'], $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