private function ContentAwareGenerator::checkLocaleRequirement

Parameters

SymfonyRoute $route:

string $locale:

Return value

bool TRUE if there is either no $locale, no _locale requirement on the route or if the requirement and the passed $locale match.

2 calls to ContentAwareGenerator::checkLocaleRequirement()
ContentAwareGenerator::getBestLocaleRoute in drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/ContentAwareGenerator.php
Determine if there is a route with matching locale associated with the given route via associated content.
ContentAwareGenerator::getRouteByLocale in drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/ContentAwareGenerator.php

File

drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/ContentAwareGenerator.php, line 206

Class

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

Namespace

Symfony\Cmf\Component\Routing

Code

private function checkLocaleRequirement(SymfonyRoute $route, $locale) {
  return empty($locale) || !$route
    ->getRequirement('_locale') || preg_match('/' . $route
    ->getRequirement('_locale') . '/', $locale);
}