PageAncestry
final class \
- Implements
- IteratorAggregate, Countable
The ancestry of a page: the page itself and its parent pages up to the root level, ordered from the page to the root level.
Page objects are only created when they are accessed.
Tags
Table of Contents
Interfaces
- IteratorAggregate
- Countable
Methods
- __construct() : mixed
- count() : int
- getIterator() : Generator<int, Page>
- getPage() : Page|null
- Returns the page the ancestry was resolved for, null if it does not exist.
- getPageIds() : array<int, int>
- getPagesFromRootLevel() : array<int, Page>
- getPermissions() : PagePermissions|null
- Returns the permission settings of a page in the ancestry. For pages with a workspace version, these are the settings of the live page.
- isComplete() : bool
- Whether the ancestry reaches the root level. It does not, if a page in between is deleted or does not exist, or if the page tree contains a cycle.
- toLegacyRootLine() : array
- Returns the records in the structure of BackendUtility::BEgetRootLine(): keys count from the root level, ordered from the page to the root level, and a complete ancestry ends with a record for the virtual tree root with uid 0.
Methods
__construct()
public
__construct(int $pageId, array<int, array<string, mixed>> $records, array<int, PagePermissions|null> $permissions, callable(array<string, mixed>): Page $pageFactory) : mixed
Parameters
- $pageId : int
- $records : array<int, array<string, mixed>>
-
Page records, ordered from the page to the root level
- $permissions : array<int, PagePermissions|null>
-
Permission settings by page uid
- $pageFactory : callable(array<string, mixed>): Page
Internal
Use PageAncestryResolver to create a page ancestry
count()
public
count() : int
Return values
intgetIterator()
public
getIterator() : Generator<int, Page>
Return values
Generator<int, Page>getPage()
Returns the page the ancestry was resolved for, null if it does not exist.
public
getPage() : Page|null
Return values
Page|nullgetPageIds()
public
getPageIds() : array<int, int>
Return values
array<int, int> —Page uids, ordered from the page to the root level
getPagesFromRootLevel()
public
getPagesFromRootLevel() : array<int, Page>
Return values
array<int, Page> —Pages, ordered from the root level to the page
getPermissions()
Returns the permission settings of a page in the ancestry. For pages with a workspace version, these are the settings of the live page.
public
getPermissions(int $pageId) : PagePermissions|null
Parameters
- $pageId : int
Return values
PagePermissions|nullisComplete()
Whether the ancestry reaches the root level. It does not, if a page in between is deleted or does not exist, or if the page tree contains a cycle.
public
isComplete() : bool
Return values
booltoLegacyRootLine()
Returns the records in the structure of BackendUtility::BEgetRootLine(): keys count from the root level, ordered from the page to the root level, and a complete ancestry ends with a record for the virtual tree root with uid 0.
public
toLegacyRootLine([bool $includeVirtualRoot = true ]) : array
Without the virtual tree root, this is the structure of RootlineUtility::get() as expected by TypoScript: the page on the root level has the key 0.
Parameters
- $includeVirtualRoot : bool = true
Internal
Only to be used to migrate consumers of BackendUtility::BEgetRootLine() and RootlineUtility::get().