PageAncestry

final class \TYPO3\CMS\Core\Domain\PageAncestry

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

implements

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

count()

public count() : int

Return values

int

getIterator()

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|null

getPageIds()

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|null

isComplete()

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

bool

toLegacyRootLine()

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

Return values

array
On this page