You are here

protected function ContentAwareGenerator::getLocale in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony-cmf/routing/ContentAwareGenerator.php \Symfony\Cmf\Component\Routing\ContentAwareGenerator::getLocale()

Determine the locale to be used with this request

Parameters

array $parameters the parameters determined by the route:

Return value

string the locale following of the parameters or any other information the router has available. defaultLocale if no other locale can be determined.

4 calls to ContentAwareGenerator::getLocale()
ContentAwareGenerator::getBestLocaleRoute in vendor/symfony-cmf/routing/ContentAwareGenerator.php
Determine if there is a route with matching locale associated with the given route via associated content.
ContentAwareGenerator::getRouteByContent in vendor/symfony-cmf/routing/ContentAwareGenerator.php
Get the route based on the $name that is an object implementing RouteReferrersReadInterface or a content found in the content repository with the content_id specified in parameters that is an instance of RouteReferrersReadInterface.
ContentAwareGenerator::unsetLocaleIfNotNeeded in vendor/symfony-cmf/routing/ContentAwareGenerator.php
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.
TestableContentAwareGenerator::getLocale in vendor/symfony-cmf/routing/Tests/Routing/ContentAwareGeneratorTest.php
Determine the locale to be used with this request
1 method overrides ContentAwareGenerator::getLocale()
TestableContentAwareGenerator::getLocale in vendor/symfony-cmf/routing/Tests/Routing/ContentAwareGeneratorTest.php
Determine the locale to be used with this request

File

vendor/symfony-cmf/routing/ContentAwareGenerator.php, line 249

Class

ContentAwareGenerator
A generator that tries to generate routes from object, route names or content objects or names.

Namespace

Symfony\Cmf\Component\Routing

Code

protected function getLocale($parameters) {
  if (isset($parameters['_locale'])) {
    return $parameters['_locale'];
  }
  if ($this
    ->getContext()
    ->hasParameter('_locale')) {
    return $this
      ->getContext()
      ->getParameter('_locale');
  }
  return $this->defaultLocale;
}