[FEATURE] Support recursive in record sitemap
[Packages/TYPO3.CMS.git] / typo3 / sysext / seo / Classes / XmlSitemap / RecordsXmlSitemapDataProvider.php
index aca31fc..b0e4fab 100644 (file)
@@ -64,6 +64,18 @@ class RecordsXmlSitemapDataProvider extends AbstractXmlSitemapDataProvider
         $constraints = [];
 
         if (!empty($pids)) {
+            $recursiveLevel = isset($this->config['recursive']) ? (int)$this->config['recursive'] : 0;
+            if ($recursiveLevel) {
+                $newList = [];
+                foreach ($pids as $pid) {
+                    $list = $this->cObj->getTreeList($pid, $recursiveLevel);
+                    if ($list) {
+                        $newList = array_merge($newList, explode(',', $list));
+                    }
+                }
+                $pids = array_merge($pids, $newList);
+            }
+
             $constraints[] = $queryBuilder->expr()->in('pid', $pids);
         }