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/, 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\, which
fetches one page per query and takes an SQL clause to end the path for a
backend user.
The new
\TYPO3\ 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\:
resolvePath (int $page Id, int $workspace Id, bool $include Deleted = 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.
resolveShown Path (Backend User Authentication $backend User, int $page Id) - 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
Page can be iterated and counted,
get returns its pages, and
is tells whether
the path starts on the root level of the page tree.
The new ViewHelper
<be: renders a page path in Fluid
templates, with the page titles and the separator escaped:
$view->assign(
'pagePath',
$this->pageAncestryResolver->resolveShownPath($backendUser, $pageId)
);
<be:pagePath path="{pagePath}" titleLimit="20" separator=" / " />
Impact
Extensions can resolve the path of a page as objects and render it with
<be: instead of building it with
Backend. All Core callers of
Backend use the new API now, so the paths in
the backend are no longer resolved with one query per page level.