/** * {@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]; }
/** * {@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]; }