/** * {@inheritdoc}. */ public function guessValues(UrlInformation $urlInformation, $object, $sitemap) { if ($urlInformation->getAlternateLocales()) { return; } $collection = $this->alternateLocaleProvider->createForContent($object); $urlInformation->setAlternateLocales($collection->toArray()); }
/** * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { if ($event->getRequest()->attributes->has($this->requestKey)) { $content = $event->getRequest()->attributes->get($this->requestKey); $this->seoPresentation->updateSeoPage($content); // look if the strategy is redirectResponse and if there is a route to redirectResponse to $response = $this->seoPresentation->getRedirectResponse(); if (false !== $response && $this->canBeRedirected($event->getRequest(), $response)) { $event->setResponse($response); } if (null !== $this->alternateLocaleProvider) { $this->seoPresentation->updateAlternateLocales($this->alternateLocaleProvider->createForContent($content)); } } }
/** * Transforms a single sitemap document into url information. * * A sitemap document is a document, which should be exposed on a sitemap. * * @param object $document * * @return UrlInformation */ protected function computeUrlInformationFromSitemapDocument($document) { $urlInformation = new UrlInformation(); $urlInformation->setLocation($this->router->generate($document, array(), true)); $urlInformation->setChangeFrequency($this->defaultChanFrequency); if ($this->alternateLocaleProvider) { $collection = $this->alternateLocaleProvider->createForContent($document); $urlInformation->setAlternateLocales($collection->toArray()); } $seoMetadata = $this->seoPresentation->getSeoMetadata($document); if (null !== $seoMetadata->getTitle()) { $urlInformation->setLabel($seoMetadata->getTitle()); return $urlInformation; } return $urlInformation; }