| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace Opentalent\OtTemplating\Page;
- use TYPO3\CMS\Frontend\Page\PageRepository;
- class OtPageRepository extends PageRepository
- {
- /**
- * Recursively returns all the subpages of the given page
- *
- * @param $pageId
- * @param string $fields
- * @param string $sortField
- * @param string $additionalWhereClause
- * @param bool $checkShortcuts
- * @return array
- */
- public function getAllSubpagesForPage($pageId) {
- $subpages = [];
- $stack = $this->getSubpagesForPages([$pageId], '*', 'sorting', '', false);
- foreach ($stack as $page) {
- $subpages[] = $page;
- $children = $this->getAllSubpagesForPage($page['uid']);
- if (!empty($children)) {
- $subpages = array_merge($subpages, $children);
- }
- }
- return $subpages;
- }
- }
|