PageTreeView

class \TYPO3\CMS\Backend\Tree\View\PageTreeView

Extends
AbstractTreeView

Generate a page-tree, non-browsable.

Table of Contents

Properties

$buffer_idH  : array
$makeHTML  : bool
If true, HTML code is also accumulated in ->tree array during rendering of the tree
$orderByFields  : string
Field for ORDER BY. Is set by function init.
$orig_ids_hierarchy  : array
$tree  : array
$clause  : string
WHERE clause used for selecting records for the tree. Is set by function init.
$currentPageId  : int|null
$fieldArray  : array
Default set of fields selected from the tree table.
$ids  : array
$ids_hierarchy  : array
$table  : string
Table of the tree records, used for their icons. The tree is always built from "pages".

Methods

addField()  : void
expandNext()  : bool
Returns TRUE/FALSE if the next level for $id should be expanded - and all levels should, so we always return true.
getTree()  : int<0, max>
Fetches the data for the tree
init()  : mixed
Init function REMEMBER to feed a $clause which will filter out non-readable pages!
setCurrentPageId()  : void
fetchSubpages()  : array<int, array<int, array<string, mixed>>>
Fetches the workspace-resolved subpages of a page down to the given depth, and one level more to know whether the pages on the last level have subpages.
getBackendUser()  : BackendUserAuthentication
getIcon()  : string
Get the icon markup for the row
getLanguageService()  : LanguageService
getTitleAttrib()  : string
Returns the value for the image "title" attribute
PMicon()  : string
Generate the plus/minus icon for the browsable tree.
reset()  : void
Resets the tree, recs, ids, ids_hierarchy and orig_ids_hierarchy internal variables. Use it if you need it.

Properties

$makeHTML

If true, HTML code is also accumulated in ->tree array during rendering of the tree

public bool $makeHTML = true

$orderByFields

Field for ORDER BY. Is set by function init.

public string $orderByFields = 'sorting'

Pages are ordered in PHP, the fields must be part of $fieldArray.

Tags

see
init()

$orig_ids_hierarchy

public array $orig_ids_hierarchy = []

$clause

WHERE clause used for selecting records for the tree. Is set by function init.

protected string $clause = ''

It is evaluated on the live page, columns may be qualified with "pages".

Tags

see
init()

$currentPageId

protected int|null $currentPageId = null

$fieldArray

Default set of fields selected from the tree table.

protected array $fieldArray = ['uid', 'pid', 'title', 'is_siteroot', 'doktype', 'nav_title…
Show the full value['uid', 'pid', 'title', 'is_siteroot', 'doktype', 'nav_title', 'mount_pid', 'php_tree_stop', 't3ver_state', 'hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'nav_hide', 't3ver_wsid', 'crdate', 'tstamp', 'sorting', 'deleted', 'perms_userid', 'perms_groupid', 'perms_user', 'perms_group', 'perms_everybody', 'editlock', 'l18n_cfg']

Make SURE that these fields names listed herein are actually possible to select from $this->table (if that variable is set to a TCA table name)

Tags

see
addField()

$ids_hierarchy

protected array $ids_hierarchy = []

$table

Table of the tree records, used for their icons. The tree is always built from "pages".

protected string $table = 'pages'

Methods

addField()

public addField(string $field) : void

Parameters

$field : string

expandNext()

Returns TRUE/FALSE if the next level for $id should be expanded - and all levels should, so we always return true.

public expandNext(int $id) : bool

Here the branch is expanded if the current id matches the global id for the listing/new

Parameters

$id : int

ID (uid) to test for

Return values

bool

getTree()

Fetches the data for the tree

public getTree(int $uid[, int $depth = 999 ][, string $depthData = '' ]) : int<0, max>

The pages of all levels are fetched with one query on the first call, the recursive calls for the levels below work on these pages.

Parameters

$uid : int

item id for which to select subitems (parent id)

$depth : int = 999

Max depth (recursivity limit)

$depthData : string = ''

HTML-code prefix for recursive calls.

Return values

int<0, max> —

The count of items on the level

init()

Init function REMEMBER to feed a $clause which will filter out non-readable pages!

public init([string $clause = '' ][, string $orderByFields = '' ]) : mixed

Parameters

$clause : string = ''

Part of where query which will filter out non-readable pages.

$orderByFields : string = ''

Record ORDER BY field

setCurrentPageId()

public setCurrentPageId(int $currentPageId) : void

Parameters

$currentPageId : int

fetchSubpages()

Fetches the workspace-resolved subpages of a page down to the given depth, and one level more to know whether the pages on the last level have subpages.

protected fetchSubpages(int $uid, int $depth) : array<int, array<int, array<string, mixed>>>

Parameters

$uid : int
$depth : int

Return values

array<int, array<int, array<string, mixed>>> —

Pages by parent page id, in the order of $this->orderByFields

getIcon()

Get the icon markup for the row

protected getIcon(array $row) : string

Parameters

$row : array

The row to get the icon for

Return values

string —

The icon markup, wrapped into a span tag, with the records title as title attribute

getTitleAttrib()

Returns the value for the image "title" attribute

protected getTitleAttrib(array $row) : string

Parameters

$row : array

The input row array (where the key "title" is used for the title)

Return values

string —

The attribute value (is htmlspecialchared() already)

PMicon()

Generate the plus/minus icon for the browsable tree.

protected PMicon(array $row, int $a, int $c, int $nextCount, bool $isOpen) : string

In this case, there is no plus-minus icon displayed.

Parameters

$row : array

Record for the entry

$a : int

The current entry number

$c : int

The total number of entries. If equal to $a, a 'bottom' element is returned.

$nextCount : int

The number of sub-elements to the current element.

$isOpen : bool

The element was expanded to render subelements if this flag is set.

Tags

see
AbstractTreeView::PMicon()

Return values

string —

Image tag with the plus/minus icon.

reset()

Resets the tree, recs, ids, ids_hierarchy and orig_ids_hierarchy internal variables. Use it if you need it.

protected reset() : void
On this page