AbstractTreeView

abstract class \TYPO3\CMS\Backend\Tree\View\AbstractTreeView

Base class for creating a browsable array/page/folder tree in HTML

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.
$fieldArray  : array
Default set of fields selected from the tree table.
$ids  : array
$ids_hierarchy  : array
$parentField  : string
Defines the field of $table which is the parent id field (like pid for table pages).
$table  : string
Database table to get the tree data from.

Methods

addField()  : void
expandNext()  : bool
Returns TRUE/FALSE if the next level for $id should be expanded - based on data in $this->stored[][] and ->expandAll flag.
getTree()  : int<0, max>
Fetches the data for the tree
init()  : mixed
getBackendUser()  : BackendUserAuthentication
getCount()  : int
Returns the number of records having the parent id, $uid
getDataInit()  : Result
Getting the tree data: Selecting/Initializing data pointer to items for a certain parent id.
getDataNext()  : array|false
Getting the tree data: next entry
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'

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 = ''

Tags

see
init()

$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 = []

$parentField

Defines the field of $table which is the parent id field (like pid for table pages).

protected string $parentField = 'pid'

$table

Database table to get the tree data from.

protected string $table = 'pages'

Leave blank if data comes from an array.

Methods

addField()

public addField(string $field) : void

Parameters

$field : string

expandNext()

Returns TRUE/FALSE if the next level for $id should be expanded - based on data in $this->stored[][] and ->expandAll flag.

public expandNext(int $id) : bool

Used in subclasses

Parameters

$id : int

Record id/key

Tags

see
PageTreeView::expandNext()

Return values

bool

getTree()

Fetches the data for the tree

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

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()

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

Parameters

$clause : string = ''

Record WHERE clause

$orderByFields : string = ''

Record ORDER BY field

getCount()

Returns the number of records having the parent id, $uid

protected getCount(int $uid) : int

Parameters

$uid : int

Id to count subitems for

Return values

int

getDataInit()

Getting the tree data: Selecting/Initializing data pointer to items for a certain parent id.

protected getDataInit(int $parentId) : Result

For tables: This will make a database query to select all children to "parent"

Parameters

$parentId : int

Return values

Result

getDataNext()

Getting the tree data: next entry

protected getDataNext(Result $res) : array|false

Parameters

$res : Result

Tags

see
getDataInit()

Return values

array|false

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

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
PageTreeView::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