From 97f0aa6f40bb7ef8130d04f7e21f7412acd007dc Mon Sep 17 00:00:00 2001 From: Tobias Duehr Date: Thu, 2 May 2019 21:27:18 +0200 Subject: [PATCH] Load all pages (for all root pages) when not providing a language --- src/Resources/contao/classes/SitemapHelper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Resources/contao/classes/SitemapHelper.php b/src/Resources/contao/classes/SitemapHelper.php index f7ab523..67bf737 100644 --- a/src/Resources/contao/classes/SitemapHelper.php +++ b/src/Resources/contao/classes/SitemapHelper.php @@ -8,13 +8,13 @@ class SitemapHelper { public static function getSitemap($lang = null) { - if (!$lang) $lang = Helper::defaultLang(); $sitemap = []; $rootPages = PageModel::findPublishedRootPages(['order' => 'sorting ASC']); foreach($rootPages as $rootPage){ - if($rootPage->language == $lang) break; + if($lang && $rootPage->language != $lang) continue; + $rootPage->loadDetails(); + $sitemap = array_merge($sitemap, PageHelper::getSubPages($rootPage->id)); } - $rootPage->loadDetails(); - return PageHelper::getSubPages($rootPage->id); + return $sitemap; } }