Feature: #111445 - Resolve page paths as objects 

See forge#111445

Description 

The backend shows the location of a page or record in the page tree as a path like /Home/About us/, for example in the record list, the live search and the move page wizard. Until now, such a path was only available as a formatted string from \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath() , which fetches one page per query and takes an SQL clause to end the path for a backend user.

The new \TYPO3\CMS\Core\Domain\PagePath holds the Page objects of the path, ordered from the root level of the page tree down to the page itself. It is resolved from the cached page ancestry by the \TYPO3\CMS\Core\Domain\PageAncestryResolver :

resolvePath(int $pageId, int $workspaceId, bool $includeDeleted = false)
Returns the whole path of a page in a workspace, regardless of the permissions of a user. The uid of a workspace version resolves the path of its live page.
resolveShownPath(BackendUserAuthentication $backendUser, int $pageId)
Returns the path of a page in the workspace of a backend user, as shown to the user: the path ends below the first page the user must not see.

A PagePath can be iterated and counted, getPages() returns its pages, and isComplete() tells whether the path starts on the root level of the page tree.

The new ViewHelper <be:pagePath> renders a page path in Fluid templates, with the page titles and the separator escaped:

EXT:my_extension/Classes/Controller/MyController.php
$view->assign(
    'pagePath',
    $this->pageAncestryResolver->resolveShownPath($backendUser, $pageId)
);
Copied!
EXT:my_extension/Resources/Private/Templates/MyTemplate.fluid.html
<be:pagePath path="{pagePath}" titleLimit="20" separator=" / " />
Copied!

Impact 

Extensions can resolve the path of a page as objects and render it with <be:pagePath> instead of building it with BackendUtility::getRecordPath() . All Core callers of BackendUtility::getRecordPath() use the new API now, so the paths in the backend are no longer resolved with one query per page level.