Files
contao-leaflet-maps/src/Netzmacht/Contao/Leaflet/Dca/Helper.php
David Molineus 07f3c4521b Code style.
2015-07-22 13:56:52 +02:00

44 lines
1006 B
PHP

<?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;
use Netzmacht\Contao\Toolkit\Dca\Callback\GenerateAliasCallback;
/**
* Helper class for dca functions.
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Helper
{
/**
* Generate an alias callback which creates a valid javascript var name.
*
* @param string $table The table.
* @param string $column The value column.
*
* @return GenerateAliasCallback
*/
public static function createGenerateAliasCallback($table, $column)
{
$callback = Dca::createGenerateAliasCallback($table, $column);
$callback->getGenerator()->addFilter(
function ($value) {
return str_replace('-', '_', $value);
}
);
return $callback;
}
}