‪TYPO3CMS  10.4
TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository Class Reference

Public Member Functions

 __construct (int $workspaceId=0, array $additionalFieldsToQuery=[], array $additionalQueryRestrictions=[])
 
array getTree (int $entryPoint, callable $callback=null, array $dbMounts=[], $resolveUserPermissions=false)
 
array getTreeLevels (array $pageTree, int $depth, array $entryPointIds=[])
 
 hasChildren (int $pid)
 
array fetchFilteredTree (string $searchFilter, array $allowedMountPointPageIds, string $additionalWhereClause)
 

Protected Member Functions

 applyCallbackToChildren (array &$tree, callable $callback)
 
 getChildPageRecords (array $parentPageIds)
 
array getPageRecords (array $pageIds=[], array $parentPageIds=[])
 
array fetchAllPages (array $dbMounts, bool $resolveUserPermissions=false)
 
 addChildrenToPage (array &$page, array &$groupedAndSortedPagesByPid)
 
array findInPageTree (int $pageId, array $pages)
 
array filterPagesOnMountPoints (array $pages, array $mountPoints)
 
array groupAndSortPages (array $pages, $groupedAndSortedPagesByPid=[])
 
BackendUserAuthentication getBackendUser ()
 

Protected Attributes

string[] $fields
 
int $currentWorkspace = 0
 
array $fullPageTree = array( )
 
array $additionalQueryRestrictions = array( )
 

Detailed Description

Fetches ALL pages in the page tree, possibly overlaid with the workspace in a sorted way.

This works agnostic of the Backend User, allows to be used in FE as well in the future.

this class is not public API yet, as it needs to be proven stable enough first.

Definition at line 40 of file PageTreeRepository.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::__construct ( int  $workspaceId = 0,
array  $additionalFieldsToQuery = [],
array  $additionalQueryRestrictions = [] 
)
Parameters
int$workspaceId‪the workspace ID to be checked for.
array$additionalFieldsToQuery‪an array with more fields that should be accessed.
array$additionalQueryRestrictions‪an array with more restrictions to add

Definition at line 104 of file PageTreeRepository.php.

References TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\$additionalQueryRestrictions.

Member Function Documentation

◆ addChildrenToPage()

TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::addChildrenToPage ( array &  $page,
array &  $groupedAndSortedPagesByPid 
)
protected

Adds the property "_children" to a page record with the child pages

Parameters
array$page
array[]$groupedAndSortedPagesByPid

Definition at line 468 of file PageTreeRepository.php.

Referenced by TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\fetchAllPages(), TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\fetchFilteredTree(), and TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\getTreeLevels().

◆ applyCallbackToChildren()

TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::applyCallbackToChildren ( array &  $tree,
callable  $callback 
)
protected

Removes items from a tree based on a callback, usually used for permission checks

Parameters
array$tree
callable$callback

Definition at line 150 of file PageTreeRepository.php.

Referenced by TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\getTree().

◆ fetchAllPages()

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::fetchAllPages ( array  $dbMounts,
bool  $resolveUserPermissions = false 
)
protected

◆ fetchFilteredTree()

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::fetchFilteredTree ( string  $searchFilter,
array  $allowedMountPointPageIds,
string  $additionalWhereClause 
)

◆ filterPagesOnMountPoints()

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::filterPagesOnMountPoints ( array  $pages,
array  $mountPoints 
)
protected

◆ findInPageTree()

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::findInPageTree ( int  $pageId,
array  $pages 
)
protected

Looking for a page by traversing the tree

Parameters
int$pageId‪the page ID to search for
array$pages‪the page tree to look for the page
Returns
‪array Array of the tree data, empty array if nothing was found

Definition at line 484 of file PageTreeRepository.php.

Referenced by TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\getTree().

◆ getBackendUser()

BackendUserAuthentication TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::getBackendUser ( )
protected
Returns
‪BackendUserAuthentication

Definition at line 757 of file PageTreeRepository.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\filterPagesOnMountPoints().

◆ getChildPageRecords()

TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::getChildPageRecords ( array  $parentPageIds)
protected

◆ getPageRecords()

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::getPageRecords ( array  $pageIds = [],
array  $parentPageIds = [] 
)
protected

◆ getTree()

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::getTree ( int  $entryPoint,
callable  $callback = null,
array  $dbMounts = [],
  $resolveUserPermissions = false 
)

Main entry point for this repository, to fetch the tree data for a page. Basically the page record, plus all child pages and their child pages recursively, stored within "_children" item.

Parameters
int$entryPoint‪the page ID to fetch the tree for
callable$callback‪a callback to be used to check for permissions and filter out pages not to be included.
array$dbMounts
bool$resolveUserPermissions
Returns
‪array

Definition at line 126 of file PageTreeRepository.php.

References TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\$fullPageTree, TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\applyCallbackToChildren(), TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\fetchAllPages(), and TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\findInPageTree().

◆ getTreeLevels()

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::getTreeLevels ( array  $pageTree,
int  $depth,
array  $entryPointIds = [] 
)

Get the page tree based on a given page record and a given depth

Parameters
array$pageTree‪The page record of the top level page you want to get the page tree of
int$depth‪Number of levels to fetch
array$entryPointIds‪entryPointIds to include
Returns
‪array An array with page records and their children

Definition at line 172 of file PageTreeRepository.php.

References TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\addChildrenToPage(), TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\getChildPageRecords(), TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\getPageRecords(), and TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\groupAndSortPages().

◆ groupAndSortPages()

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::groupAndSortPages ( array  $pages,
  $groupedAndSortedPagesByPid = [] 
)
protected

Group pages by parent page and sort pages based on sorting property

Parameters
array$pages
array$groupedAndSortedPagesByPid
Returns
‪array

Definition at line 735 of file PageTreeRepository.php.

Referenced by TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\fetchFilteredTree(), and TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository\getTreeLevels().

◆ hasChildren()

TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::hasChildren ( int  $pid)

Member Data Documentation

◆ $additionalQueryRestrictions

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::$additionalQueryRestrictions = array( )
protected

◆ $currentWorkspace

int TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::$currentWorkspace = 0
protected

The workspace ID to operate on

Definition at line 87 of file PageTreeRepository.php.

◆ $fields

string [] TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::$fields
protected

Fields to be queried from the database

Definition at line 46 of file PageTreeRepository.php.

◆ $fullPageTree

array TYPO3\CMS\Backend\Tree\Repository\PageTreeRepository::$fullPageTree = array( )
protected