protected function ContentAwareGenerator::unsetLocaleIfNotNeeded in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony-cmf/routing/ContentAwareGenerator.php \Symfony\Cmf\Component\Routing\ContentAwareGenerator::unsetLocaleIfNotNeeded()
If the _locale parameter is allowed by the requirements of the route and it is the default locale, remove it from the parameters so that we do not get an unneeded ?_locale= query string.
Parameters
SymfonyRoute $route The route being generated.:
array $parameters The parameters used, will be modified to: remove the _locale field if needed.
1 call to ContentAwareGenerator::unsetLocaleIfNotNeeded()
- ContentAwareGenerator::generate in vendor/
symfony-cmf/ routing/ ContentAwareGenerator.php
File
- vendor/
symfony-cmf/ routing/ ContentAwareGenerator.php, line 306
Class
- ContentAwareGenerator
- A generator that tries to generate routes from object, route names or content objects or names.
Namespace
Symfony\Cmf\Component\RoutingCode
protected function unsetLocaleIfNotNeeded(SymfonyRoute $route, array &$parameters) {
$locale = $this
->getLocale($parameters);
if (null !== $locale) {
if (preg_match('/' . $route
->getRequirement('_locale') . '/', $locale) && $locale == $route
->getDefault('_locale')) {
$compiledRoute = $route
->compile();
if (!in_array('_locale', $compiledRoute
->getVariables())) {
unset($parameters['_locale']);
}
}
}
}