diff --git a/AdapterInterface.php b/AdapterInterface.php index bd06bc8..2eead61 100644 --- a/AdapterInterface.php +++ b/AdapterInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Cmf\Component\RoutingAuto; use Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface; +use Sulu\Component\DocumentManager\ClassNameInflector; /** * Adapters will abstract all persistence operations. diff --git a/TokenProvider/ContentMethodProvider.php b/TokenProvider/ContentMethodProvider.php index 9aebec5..4314129 100644 --- a/TokenProvider/ContentMethodProvider.php +++ b/TokenProvider/ContentMethodProvider.php @@ -29,11 +29,18 @@ public function __construct(SlugifierInterface $slugifier) */ protected function normalizeValue($value, UriContext $uriContext, $options) { + $values = array($value); + if ($options['preserve_slashes']) { + $values = explode('/', $value); + } + if ($options['slugify']) { - $value = $this->slugifier->slugify($value); + foreach ($values as &$value) { + $value = $this->slugifier->slugify($value); + } } - return $value; + return implode('/', $values); } /** @@ -45,6 +52,7 @@ public function configureOptions(OptionsResolverInterface $optionsResolver) $optionsResolver->setDefaults(array( 'slugify' => true, + 'preserve_slashes' => false, )); $newApi = method_exists($optionsResolver, 'setDefined');