getTargetLocale() public method

Returns locale for target.
public getTargetLocale ( ) : string
return string
示例#1
0
文件: SeoEnhancer.php 项目: sulu/sulu
 /**
  * {@inheritdoc}
  */
 protected function doEnhance(CustomUrlBehavior $customUrl, Webspace $webspace, array $defaults, Request $request)
 {
     $seo = ['noFollow' => $customUrl->isNoFollow(), 'noIndex' => $customUrl->isNoIndex()];
     if ($customUrl->isCanonical()) {
         $resourceSegment = $customUrl->getTargetDocument()->getResourceSegment();
         $seo['canonicalUrl'] = $this->webspaceManager->findUrlByResourceLocator($resourceSegment, $defaults['_environment'], $customUrl->getTargetLocale(), $webspace->getKey());
     }
     return ['_seo' => $seo];
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 protected function doEnhance(CustomUrlBehavior $customUrl, Webspace $webspace, array $defaults, Request $request)
 {
     $resourceSegment = '/';
     if ($customUrl->getTargetDocument() !== null) {
         $resourceSegment = $customUrl->getTargetDocument()->getResourceSegment();
     }
     $url = $this->webspaceManager->findUrlByResourceLocator($resourceSegment, $defaults['_environment'], $customUrl->getTargetLocale(), $defaults['_webspace']->getKey());
     return ['_controller' => 'SuluWebsiteBundle:Default:redirect', 'url' => $url];
 }