ElementBrowserPageTreeView extends BrowseTreeView
Class which generates the selectable page tree
not needed anymore, will be removed in TYPO3 v13.0
Browsable tree, used in PagePositionMaps (move elements), the Link Wizard and the Database Browser (for which it will be extended)
Table of Contents
Properties
- $BE_USER : BackendUserAuthentication|string
- Needs to be initialized with $GLOBALS['BE_USER'] Done by default in init()
- $buffer_idH : array<string|int, mixed>
- $clause : string
- WHERE clause used for selecting records for the tree. Is set by function init.
- $defaultList : string
- List of other fields which are ALLOWED to set (here, based on the "pages" table!)
- $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>
- $makeHTML : int
- If 1, 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>
- $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.
- $thisScript : string
- $title : string
- $tree : array<string|int, mixed>
- $iconFactory : IconFactory
- $linkParameterProvider : LinkParameterProviderInterface
Methods
- __construct() : mixed
- Constructor. Just calling init()
- addField() : mixed
- Adds a fieldname to the internal array ->fieldArray
- addTagAttributes() : string
- Adds attributes to image tag.
- expandNext() : bool
- Returns TRUE/FALSE if the next level for $id should be expanded - based on data in $this->stored[][] and ->expandAll flag.
- ext_isLinkable() : bool
- Returns TRUE if a doktype can be linked.
- getCount() : int
- Returns the number of records having the parent id, $uid
- getDataCount() : int
- Getting the tree data: Counting elements in resource
- getDataFree() : mixed
- Getting the tree data: frees data handle
- getDataInit() : mixed
- Getting the tree data: Selecting/Initializing data pointer to items for a certain parent id.
- getDataNext() : array<string|int, mixed>|bool
- Getting the tree data: next entry
- getIcon() : string
- Get the icon markup for the row
- getRootIcon() : string
- Returns the root icon for a tree/mountpoint (defaults to the globe)
- getRootRecord() : array<string|int, mixed>
- Returns root record for uid (<=0)
- getTitleAttrib() : string
- Creates title attribute content for pages.
- getTitleStr() : string
- Returns the title for the input record. If blank, a "no title" label (localized) will be returned.
- getTree() : int
- Fetches the data for the tree
- init() : mixed
- Initialize, setting what is necessary for browsing pages.
- PM_ATagWrap() : string
- Wrap the plus/minus icon in a link
- PMicon() : string
- Generate the plus/minus icon for the browsable tree.
- printTree() : string
- Create the page navigation tree in HTML
- reset() : mixed
- Resets the tree, recs, ids, ids_hierarchy and orig_ids_hierarchy internal variables. Use it if you need it.
- setLinkParameterProvider() : mixed
- wrapTitle() : string
- Wrapping the title in a link, if applicable.
- determineScriptUrl() : mixed
- Sets the script url depending on being a module or script request
- getBackendUser() : BackendUserAuthentication
- getLanguageService() : LanguageService
- getThisScript() : string
Properties
$BE_USER
Needs to be initialized with $GLOBALS['BE_USER'] Done by default in init()
will be removed in TYPO3 v13.0 as it is not in use anymore.
public
BackendUserAuthentication|string
$BE_USER
= ''
$buffer_idH
public
array<string|int, mixed>
$buffer_idH
= []
$clause
WHERE clause used for selecting records for the tree. Is set by function init.
public
string
$clause
= ''
since TYPO3 v12, will be marked as protected in TYPO3 v13.0.
Tags
$defaultList
List of other fields which are ALLOWED to set (here, based on the "pages" table!)
public
string
$defaultList
= 'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate'
since TYPO3 v12, will be marked as protected in TYPO3 v13.0.
Tags
$fieldArray
Default set of fields selected from the tree table.
public
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']
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)
since TYPO3 v12, will be marked as protected in TYPO3 v13.0.
Tags
$ids
public
array<string|int, mixed>
$ids
= []
$ids_hierarchy
public
array<string|int, mixed>
$ids_hierarchy
= []
$makeHTML
If 1, HTML code is also accumulated in ->tree array during rendering of the tree
public
int
$makeHTML
= 1
$orderByFields
Field for ORDER BY. Is set by function init.
public
string
$orderByFields
= ''
since TYPO3 v12, will be marked as protected in TYPO3 v13.0.
Tags
$orig_ids_hierarchy
public
array<string|int, mixed>
$orig_ids_hierarchy
= []
$parentField
Defines the field of $table which is the parent id field (like pid for table pages).
public
string
$parentField
= 'pid'
since TYPO3 v12 will be marked as protected in TYPO3 v13.0.
$table
Database table to get the tree data from.
public
string
$table
= 'pages'
Leave blank if data comes from an array.
since TYPO3 v12 will be marked as protected in TYPO3 v13.0.
$thisScript
will be removed in TYPO3 v13.0.
public
string
$thisScript
= ''
$title
public
string
$title
= 'no title'
since TYPO3 v12 will be marked as protected in TYPO3 v13.0.
$tree
public
array<string|int, mixed>
$tree
= []
$iconFactory
protected
IconFactory
$iconFactory
$linkParameterProvider
protected
LinkParameterProviderInterface
$linkParameterProvider
Methods
__construct()
Constructor. Just calling init()
public
__construct() : mixed
addField()
Adds a fieldname to the internal array ->fieldArray
public
addField(string $field[, bool $noCheck = false ]) : mixed
Parameters
- $field : string
-
Field name to
- $noCheck : bool = false
-
If set, the fieldname will be set no matter what. Otherwise the field name must either be found as key in $GLOBALS['TCA'][$table]['columns'] or in the list ->defaultList
addTagAttributes()
Adds attributes to image tag.
public
addTagAttributes(string $icon, string $attr) : string
will be removed in TYPO3 v13.0.
Parameters
- $icon : string
-
Icon image tag
- $attr : string
-
Attributes to add, eg. ' border="0"'
Return values
string —Image tag, modified with $attr attributes added.
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
Return values
boolext_isLinkable()
Returns TRUE if a doktype can be linked.
public
ext_isLinkable(int $doktype, int $uid) : bool
Parameters
- $doktype : int
-
Doktype value to test
- $uid : int
-
uid to test.
Return values
boolgetCount()
Returns the number of records having the parent id, $uid
public
getCount(int $uid) : int
Parameters
- $uid : int
-
Id to count subitems for
Return values
intgetDataCount()
Getting the tree data: Counting elements in resource
public
getDataCount(mixed &$res) : int
Parameters
- $res : mixed
-
Data handle
Tags
Return values
int —number of items
getDataFree()
Getting the tree data: frees data handle
public
getDataFree(mixed &$res) : mixed
Parameters
- $res : mixed
-
Data handle
getDataInit()
Getting the tree data: Selecting/Initializing data pointer to items for a certain parent id.
public
getDataInit(int $parentId) : mixed
For tables: This will make a database query to select all children to "parent" For arrays: This will return key to the ->dataLookup array
Parameters
- $parentId : int
-
parent item id
Return values
mixed —Data handle (Tables: An sql-resource, arrays: A parentId integer. -1 is returned if there were NO subLevel.)
getDataNext()
Getting the tree data: next entry
public
getDataNext(mixed &$res) : array<string|int, mixed>|bool
Parameters
- $res : mixed
-
Data handle
Tags
Return values
array<string|int, mixed>|bool —item data array OR FALSE if end of elements.
getIcon()
Get the icon markup for the row
public
getIcon(array<string|int, mixed> $row) : string
Parameters
- $row : array<string|int, mixed>
-
The row to get the icon for
since TYPO3 v12, will be marked as protected in TYPO3 v13.0.
Return values
string —The icon markup, wrapped into a span tag, with the records title as title attribute
getRootIcon()
Returns the root icon for a tree/mountpoint (defaults to the globe)
public
getRootIcon(array<string|int, mixed> $rec) : string
will be removed in TYPO3 v13.0.
Parameters
- $rec : array<string|int, mixed>
-
Record for root.
Return values
string —Icon image tag.
getRootRecord()
Returns root record for uid (<=0)
public
getRootRecord() : array<string|int, mixed>
will be removed in TYPO3 v13.0.
Return values
array<string|int, mixed> —Array with title/uid keys with values of $this->title/0 (zero)
getTitleAttrib()
Creates title attribute content for pages.
public
getTitleAttrib(array<string|int, mixed> $row) : string
Uses API function in \TYPO3\CMS\Backend\Utility\BackendUtility which will retrieve lots of useful information for pages.
Parameters
- $row : array<string|int, mixed>
-
The table row.
Return values
stringgetTitleStr()
Returns the title for the input record. If blank, a "no title" label (localized) will be returned.
public
getTitleStr(array<string|int, mixed> $row[, int $titleLen = 30 ]) : string
Do NOT htmlspecialchar the string from this function - has already been done.
Parameters
- $row : array<string|int, mixed>
-
The input row array (where the key "title" is used for the title)
- $titleLen : int = 30
-
Title length (30)
Return values
string —The title.
getTree()
Fetches the data for the tree
public
getTree(int $uid[, int $depth = 999 ][, string $depthData = '' ]) : int
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 —The count of items on the level
init()
Initialize, setting what is necessary for browsing pages.
public
init([string $clause = '' ][, string $orderByFields = '' ]) : mixed
Using the current user.
Parameters
- $clause : string = ''
-
Additional clause for selecting pages.
- $orderByFields : string = ''
-
record ORDER BY field
PM_ATagWrap()
Wrap the plus/minus icon in a link
public
PM_ATagWrap([string $bMark = '' ][, bool $isOpen = false ]) : string
Parameters
- $bMark : string = ''
-
If set, the link will have a name attribute (=$bMark)
- $isOpen : bool = false
Return values
string —Link-wrapped input string
PMicon()
Generate the plus/minus icon for the browsable tree.
public
PMicon(array<string|int, mixed> $row, int $a, int $c, int $nextCount, bool $isOpen) : string
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.
printTree()
Create the page navigation tree in HTML
public
printTree([array<string|int, mixed>|string $treeArr = '' ]) : string
Parameters
- $treeArr : array<string|int, mixed>|string = ''
-
Tree array
Return values
string —HTML output.
reset()
Resets the tree, recs, ids, ids_hierarchy and orig_ids_hierarchy internal variables. Use it if you need it.
public
reset() : mixed
setLinkParameterProvider()
public
setLinkParameterProvider(LinkParameterProviderInterface $linkParameterProvider) : mixed
Parameters
- $linkParameterProvider : LinkParameterProviderInterface
wrapTitle()
Wrapping the title in a link, if applicable.
public
wrapTitle(string $title, array<string|int, mixed> $v) : string
Parameters
- $title : string
-
Title, (must be ready for output, that means it must be htmlspecialchars()'ed).
- $v : array<string|int, mixed>
-
The record
Return values
string —Wrapping title string.
determineScriptUrl()
Sets the script url depending on being a module or script request
protected
determineScriptUrl() : mixed
will be removed in TYPO3 v13.0.
getBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetThisScript()
protected
getThisScript() : string
will be removed in TYPO3 v13.0. No deprecation is thrown due to a usage in ElementBrowserPageTreeView (which is also deprecated).