2 declare(strict_types = 1);
19 use Psr\Http\Message\ServerRequestInterface;
60 public function render(): string
64 $this->view->assign(
'type',
$GLOBALS[
'TSFE']->type);
65 if (!empty($sitemap = $request->getQueryParams()[
'sitemap'])) {
76 protected function renderIndex(ServerRequestInterface $request): string
79 foreach ($this->configuration[
'config'][
'xmlSitemap'][
'sitemaps'] ?? [] as $sitemap => $config) {
80 if (class_exists($config[
'provider']) &&
81 is_subclass_of($config[
'provider'], XmlSitemapDataProviderInterface::class)) {
83 $provider = GeneralUtility::makeInstance(
87 (array)$config[
'config']
90 $pages = $provider->getNumberOfPages();
92 for ($page = 0; $page < $pages; $page++) {
96 'lastMod' => $provider->getLastModified()
102 $this->view->assign(
'sitemaps', $sitemaps);
103 $this->view->setTemplate(
'Index');
105 return $this->view->render();
114 protected function renderSitemap(ServerRequestInterface $request,
string $sitemap): string
116 if (!empty($sitemapConfig = $this->configuration[
'config'][
'xmlSitemap'][
'sitemaps'][$sitemap])) {
117 if (class_exists($sitemapConfig[
'provider']) &&
118 is_subclass_of($sitemapConfig[
'provider'], XmlSitemapDataProviderInterface::class)) {
120 $provider = GeneralUtility::makeInstance(
121 $sitemapConfig[
'provider'],
124 (array)$sitemapConfig[
'config']
127 $items = $provider->getItems();
129 $template = $sitemapConfig[
'config'][
'template'] ?:
'Sitemap';
130 $this->view->setTemplate($template);
131 $this->view->assign(
'items', $items);
133 return $this->view->render();
135 throw new InvalidConfigurationException(
'No valid provider set for ' . $sitemap, 1535578522);
138 throw new InvalidConfigurationException(
'No valid configuration found for sitemap ' . $sitemap, 1535578569);
146 $view = GeneralUtility::makeInstance(StandaloneView::class);
161 $configurationManager = GeneralUtility::makeInstance(ObjectManager::class)
162 ->get(ConfigurationManagerInterface::class);
164 return $configurationManager->getConfiguration(