generateItems(); } protected function generateItems(): void { $pageRepository = GeneralUtility::makeInstance(PageRepository::class); $pages = $pageRepository->getPagesOverlay($this->getPages()); $languageAspect = $this->getCurrentLanguageAspect(); foreach ($pages as $page) { if (!$pageRepository->isPageSuitableForLanguage($page, $languageAspect)) { continue; } $this->items[] = [ 'uid' => $page['uid'], 'lastMod' => (int)($page['SYS_LASTCHANGED'] ?: $page['tstamp']) ]; } } /** * @return array */ protected function getPages(): array { if (!empty($this->config['rootPage'])) { $rootPageId = (int)$this->config['rootPage']; } else { $site = $this->request->getAttribute('site'); $rootPageId = $site->getRootPageId(); } $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class); $treeList = $cObj->getTreeList(-$rootPageId, 99); $treeListArray = GeneralUtility::intExplode(',', $treeList); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getQueryBuilderForTable('pages'); $constraints = [ $queryBuilder->expr()->in('uid', $treeListArray) ]; if (!empty($this->config['additionalWhere'])) { $constraints[] = QueryHelper::stripLogicalOperatorPrefix($this->config['additionalWhere']); } if (!empty($this->config['excludedDoktypes'])) { $excludedDoktypes = GeneralUtility::intExplode(',', $this->config['excludedDoktypes']); if (!empty($excludedDoktypes)) { $constraints[] = $queryBuilder->expr()->notIn('doktype', implode(',', $excludedDoktypes)); } } $pages = $queryBuilder->select('*') ->from('pages') ->where(...$constraints) ->orderBy('uid', 'ASC') ->execute() ->fetchAll(); return $pages; } /** * @return LanguageAspect */ protected function getCurrentLanguageAspect(): LanguageAspect { return GeneralUtility::makeInstance(Context::class)->getAspect('language'); } /** * @param array $data * @return array */ protected function defineUrl(array $data): array { $typoLinkConfig = [ 'parameter' => $data['uid'], 'forceAbsoluteUrl' => 1, ]; $data['loc'] = $this->cObj->typoLink_URL($typoLinkConfig); return $data; } }