Skip to content

Commit

Permalink
Load all pages (for all root pages) when not providing a language
Browse files Browse the repository at this point in the history
  • Loading branch information
saibotd authored May 2, 2019
1 parent 3ed53fa commit 97f0aa6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Resources/contao/classes/SitemapHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 97f0aa6

Please sign in to comment.