TYPO3  7.6
Public Member Functions | Protected Attributes | List of all members
TreeNode Class Reference
Inheritance diagram for TreeNode:
ComparableNodeInterface ExtDirectNode TreeRepresentationNode PagetreeNode DatabaseTreeNode

Public Member Functions

 __construct (array $data=array())
 
 setChildNodes (\TYPO3\CMS\Backend\Tree\TreeNodeCollection $childNodes)
 
 removeChildNodes ()
 
 getChildNodes ()
 
 hasChildNodes ()
 
 setId ($id)
 
 getId ()
 
 setParentNode (\TYPO3\CMS\Backend\Tree\TreeNode $parentNode=null)
 
 getParentNode ()
 
 equals (\TYPO3\CMS\Backend\Tree\TreeNode $other)
 
 compareTo ($other)
 
 toArray ($addChildNodes=true)
 
 dataFromArray ($data)
 
 serialize ()
 
 unserialize ($serializedString)
 

Protected Attributes

 $id = ''
 
 $parentNode = null
 
 $childNodes = null
 

Detailed Description

Tree Node

Definition at line 22 of file TreeNode.php.

Constructor & Destructor Documentation

__construct ( array  $data = array())

Constructor

You can move an initial data array to initialize the instance and further objects. This is useful for the deserialization.

Parameters
array$data

Definition at line 53 of file TreeNode.php.

References TreeNode\dataFromArray().

Member Function Documentation

compareTo (   $other)

Compares a node to another one.

Returns: 1 if its greater than the other one -1 if its smaller than the other one 0 if its equal

Parameters
\TYPO3\CMS\Backend\Tree\TreeNode$other
Returns
int See description above

Implements ComparableNodeInterface.

Definition at line 171 of file TreeNode.php.

References TreeNode\equals().

dataFromArray (   $data)

Sets data of the node by a given data array

Parameters
array$data
Returns
void

Definition at line 210 of file TreeNode.php.

References GeneralUtility\makeInstance(), TreeNode\setChildNodes(), TreeNode\setId(), and TreeNode\setParentNode().

Referenced by TreeNode\__construct(), and TreeNode\unserialize().

equals ( \TYPO3\CMS\Backend\Tree\TreeNode  $other)

Compares a node if it's identical to another node by the id property.

Parameters
\TYPO3\CMS\Backend\Tree\TreeNode$other
Returns
bool

Definition at line 155 of file TreeNode.php.

Referenced by PagetreeNode\canBeCopied(), PagetreeNode\canBeCut(), PagetreeNode\canBePastedAfter(), PagetreeNode\canBePastedInto(), PagetreeNode\canBeRemoved(), DatabaseTreeNode\compareTo(), TreeNode\compareTo(), and PagetreeNode\isDeleted().

getChildNodes ( )

Returns child nodes collection

Returns

Definition at line 89 of file TreeNode.php.

References TreeNode\$childNodes.

getId ( )

Returns the identifier

Returns
string

Definition at line 123 of file TreeNode.php.

References TreeNode\$id.

Referenced by PagetreeNode\calculateNodeId(), PagetreeNode\toArray(), and ExtDirectNode\toArray().

getParentNode ( )

Returns the parent node

Returns

Definition at line 144 of file TreeNode.php.

References TreeNode\$parentNode.

hasChildNodes ( )

Returns TRUE if the node has child nodes attached

Returns
bool

Definition at line 99 of file TreeNode.php.

Referenced by TreeNode\toArray(), and ExtDirectNode\toArray().

removeChildNodes ( )

Removes child nodes collection

Returns
void

Definition at line 76 of file TreeNode.php.

serialize ( )

Returns the serialized instance

Returns
string

Definition at line 226 of file TreeNode.php.

References TreeNode\toArray().

setChildNodes ( \TYPO3\CMS\Backend\Tree\TreeNodeCollection  $childNodes)

Sets the child nodes collection

Parameters
\TYPO3\CMS\Backend\Tree\TreeNodeCollection$childNodes
Returns
void

Definition at line 66 of file TreeNode.php.

References TreeNode\$childNodes.

Referenced by TreeNode\dataFromArray().

setId (   $id)

Sets the identifier

Parameters
string$id
Returns
void

Definition at line 113 of file TreeNode.php.

References TreeNode\$id.

Referenced by TreeNode\dataFromArray().

setParentNode ( \TYPO3\CMS\Backend\Tree\TreeNode  $parentNode = null)

Sets the parent node

Parameters
NULL | \TYPO3\CMS\Backend\Tree\TreeNode$parentNode
Returns
void

Definition at line 134 of file TreeNode.php.

References TreeNode\$parentNode.

Referenced by TreeNode\dataFromArray().

toArray (   $addChildNodes = true)

Returns the node in an array representation that can be used for serialization

Parameters
bool$addChildNodes
Returns
array

Definition at line 185 of file TreeNode.php.

References TreeNode\hasChildNodes().

Referenced by TreeNode\serialize().

unserialize (   $serializedString)

Fills the current node with the given serialized informations

Exceptions
\TYPO3\CMS\Core\Exceptionif the deserialized object type is not identical to the current one
Parameters
string$serializedString
Returns
void

Definition at line 238 of file TreeNode.php.

References TreeNode\dataFromArray().

Member Data Documentation

$childNodes = null
protected

Definition at line 43 of file TreeNode.php.

Referenced by TreeNode\getChildNodes(), and TreeNode\setChildNodes().

$id = ''
protected

Definition at line 29 of file TreeNode.php.

Referenced by TreeNode\getId(), and TreeNode\setId().

$parentNode = null
protected

Definition at line 36 of file TreeNode.php.

Referenced by TreeNode\getParentNode(), and TreeNode\setParentNode().