You are here

protected function ContentAwareGenerator::getRouteByLocale 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::getRouteByLocale()

Parameters

RouteCollection $routes:

string $locale:

Return value

bool|SymfonyRoute false if no route requirement matches the provided locale

2 calls to ContentAwareGenerator::getRouteByLocale()
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.

File

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

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 getRouteByLocale($routes, $locale) {
  foreach ($routes as $route) {
    if (!$route instanceof SymfonyRoute) {
      continue;
    }
    if ($this
      ->checkLocaleRequirement($route, $locale)) {
      return $route;
    }
  }
  return false;
}