Fix the alias generator. Do not use -.

This commit is contained in:
David Molineus
2016-10-05 14:48:57 +02:00
parent 5a41b2b5d8
commit 8e89cc3616
2 changed files with 2 additions and 40 deletions

View File

@@ -135,8 +135,7 @@ $container['leaflet.alias-generator'] = $container->share(
$filters = [
new ExistingAliasFilter(),
new SlugifyFilter($fields),
new SuffixFilter(),
new UnderscoreFilter(false)
new SuffixFilter(false),
];
$validator = new UniqueDatabaseValueValidator(
@@ -145,7 +144,7 @@ $container['leaflet.alias-generator'] = $container->share(
$aliasField
);
return new FilterBasedAliasGenerator($filters, $validator, $dataContainerName, $aliasField);
return new FilterBasedAliasGenerator($filters, $validator, $dataContainerName, $aliasField, '_');
};
}
);

View File

@@ -1,37 +0,0 @@
<?php
/**
* @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2016 netzmacht David Molineus. All rights reserved.
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Alias;
use Netzmacht\Contao\Toolkit\Data\Alias\Filter;
/**
* Class UnderscoreFilter
*
* @package Netzmacht\Contao\Leaflet\Alias
*/
class UnderscoreFilter extends Filter\AbstractFilter
{
/**
* {@inheritDoc}
*/
public function repeatUntilValid()
{
return false;
}
/**
* {@inheritDoc}
*/
public function apply($model, $value, $separator)
{
return str_replace('-', '_', $value);
}
}