You are here

private function ContentAwareGenerator::checkLocaleRequirement in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony-cmf/routing/ContentAwareGenerator.php \Symfony\Cmf\Component\Routing\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 vendor/symfony-cmf/routing/ContentAwareGenerator.php
Determine if there is a route with matching locale associated with the given route via associated content.
ContentAwareGenerator::getRouteByLocale in vendor/symfony-cmf/routing/ContentAwareGenerator.php

File

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

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);
}