PageTreeView extends AbstractTreeView
Generate a page-tree, non-browsable.
This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
Table of Contents
Properties
- $buffer_idH : array<string|int, mixed>
- $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<string|int, mixed>
- $tree : array<string|int, mixed>
- $clause : string
- WHERE clause used for selecting records for the tree. Is set by function init.
- $currentPageId : int|null
- $fieldArray : array<string|int, mixed>
- Default set of fields selected from the tree table.
- $ids : array<string|int, mixed>
- $ids_hierarchy : array<string|int, mixed>
- $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 - 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
- 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<string|int, mixed>|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
$buffer_idH
public
array<string|int, mixed>
$buffer_idH
= []
$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
$orig_ids_hierarchy
public
array<string|int, mixed>
$orig_ids_hierarchy
= []
$tree
public
array<string|int, mixed>
$tree
= []
$clause
WHERE clause used for selecting records for the tree. Is set by function init.
protected
string
$clause
= ''
Tags
$currentPageId
protected
int|null
$currentPageId
= null
$fieldArray
Default set of fields selected from the tree table.
protected
array<string|int, mixed>
$fieldArray
= ['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
$ids
protected
array<string|int, mixed>
$ids
= []
$ids_hierarchy
protected
array<string|int, mixed>
$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 - 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
boolgetTree()
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()
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
getBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetCount()
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
intgetDataInit()
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
ResultgetDataNext()
Getting the tree data: next entry
protected
getDataNext(Result $res) : array<string|int, mixed>|false
Parameters
- $res : Result
Tags
Return values
array<string|int, mixed>|falsegetIcon()
Get the icon markup for the row
protected
getIcon(array<string|int, mixed> $row) : string
Parameters
- $row : array<string|int, mixed>
-
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
getLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetTitleAttrib()
Returns the value for the image "title" attribute
protected
getTitleAttrib(array<string|int, mixed> $row) : string
Parameters
- $row : array<string|int, mixed>
-
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<string|int, mixed> $row, int $a, int $c, int $nextCount, bool $isOpen) : string
In this case, there is no plus-minus icon displayed.
Parameters
- $row : array<string|int, mixed>
-
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
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