CoolCMS API

TreeTrait

Table of Contents

Methods

deleteTreeNode()  : Result
insertTreeNode()  : Result
moveSubtree()  : Result
moveSubtreeTo()  : Result
moveTreeNode()  : Result
reorderChildren()  : Result

Methods

moveSubtree()

public moveSubtree(int $id, int|null $newParentId, TreeConfig $config) : Result
Parameters
$id : int
$newParentId : int|null

null moves to the root level

$config : TreeConfig
Return values
Result

moveSubtreeTo()

public moveSubtreeTo(int $id, int|null $newParentId, int $afterId, TreeConfig $config[, TreeMoveExpectation|null $expectation = null ]) : Result
Parameters
$id : int
$newParentId : int|null

null is the root level

$afterId : int

-1 first child, 0 last child, >0 after that sibling

$config : TreeConfig
$expectation : TreeMoveExpectation|null = null

expected state of the move (null skips the check)

Return values
Result

reorderChildren()

public reorderChildren(int|null $parentId, array<int, int> $orderedIds, TreeConfig $config) : Result
Parameters
$parentId : int|null

null is the root level

$orderedIds : array<int, int>

child ids in the new order

$config : TreeConfig
Return values
Result
On this page

Search results