getProvider() public méthode

Returns provider for given alias.
public getProvider ( string $alias ) : Sulu\Bundle\WebsiteBundle\Sitemap\SitemapProviderInterface
$alias string
Résultat Sulu\Bundle\WebsiteBundle\Sitemap\SitemapProviderInterface
Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function renderSitemap($alias, $page, $locale, Portal $portal, $host, $scheme)
 {
     if (!$this->sitemapProviderPool->hasProvider($alias)) {
         return;
     }
     $provider = $this->sitemapProviderPool->getProvider($alias);
     if ($provider->getMaxPage() < $page) {
         return;
     }
     $entries = $provider->build($page, $portal->getKey(), $locale);
     return $this->render('SuluWebsiteBundle:Sitemap:sitemap.xml.twig', ['webspaceKey' => $portal->getWebspace()->getKey(), 'locale' => $locale, 'defaultLocale' => $portal->getXDefaultLocalization()->getLocale(), 'domain' => $host, 'scheme' => $scheme, 'entries' => $entries]);
 }
Exemple #2
0
 /**
  * Render sitemap for provider.
  *
  * @param string $alias
  * @param PortalInformation $portalInformation
  * @param string $scheme
  */
 private function dumpProviderSitemap($alias, PortalInformation $portalInformation, $scheme)
 {
     $maxPage = $this->sitemapProviderPool->getProvider($alias)->getMaxPage();
     for ($page = 1; $page <= $maxPage; ++$page) {
         $sitemap = $this->sitemapRenderer->renderSitemap($alias, $page, $portalInformation->getLocale(), $portalInformation->getPortal(), $portalInformation->getHost(), $scheme);
         $this->dumpFile($this->getDumpPath($scheme, $portalInformation->getWebspaceKey(), $portalInformation->getLocale(), $portalInformation->getHost(), $alias, $page), $sitemap);
     }
 }