| package |
Default |
|---|
__construct(array $config = array(), \InfinityTree\Interfaces\Storage $storage = null, \InfinityTree\Interfaces\Validation $validation = null)
arrayConfig array, optinal, rewrites rules loaded from file
\InfinityTree\Interfaces\StorageThe adapter for the storage
\InfinityTree\Interfaces\ValidationThe validation adapter
addNode(integer $parent = null, string $name) : \InfinityTree\Node
integerThe parent node's ID to add to
stringName of the node
\InfinityTree\NodeReturns the created node
convertTo(array $tree, string $to, \InfinityTree\Interfaces\Conversion $conversion = null) : mixed
arrayThe tree in array format
stringThe param that decides the output
\InfinityTree\Interfaces\ConversionIf you want, you can pass your own conversion class, it just has to implement the interface
mixedReturns the output in the format required
deleteNode(integer $id, boolean $delete_subtree = false) : boolean
integerThe id of the node
booleanIf true, deletes the whole subtree, otherwise moves subtree to root
boolean
findNode(mixed $by) : array
mixedCan be either the id, the slug or the name of the node
arrayReturns all the found nodes or empty array if none found
getErrors()
initTree(integer $id)
integerThe id of the tree you want to use
moveNode(integer $node, integer $to, integer $order = 1) : boolean
integerId of the node to move
integerId of the node to move to, root if null
integerThe place of the moved node on the level it is on Use order like: 2, this means the node will be moved to the second place
boolean
treeAsArray(integer $root = null, boolean $flat = false) : array
integerThe node to start the tree from
booleanIf true, it returns all the children of a given root in a flat array
array
updateNode(integer $id, string $name) : boolean
integerThe id of the node to update (cannot be root)
stringThe new name of the node
boolean
_config : array
| var |
Holds the configuration array for this library |
|---|
array
_storage : \InfnityTree\Interfaces\Storage
| var |
Holds the implemented storage adapter |
|---|
\InfnityTree\Interfaces\Storage
_validation : \InfinityTree\Interfaces\Validation
| var |
Holds the implemented validation adapter |
|---|
\InfinityTree\Interfaces\Validation
_tree : \InfinityTree\Tree
| var |
Holds the tree we work on |
|---|
\InfinityTree\Tree
_errors : array
| var |
An associative array with the errors happening during tree handling |
|---|
array