I try to rewrite the dump_tree() function to my needs, but when I do that I'll receive an error: Fuel\Core\PhpErrorException [ Notice ]: Undefined index: right_id
It's not simple to change the logic of dump_tree, it makes heavy use of pointer referencing to keep track of current and parent nodes, to build the multi-dimensional view of the tree.
if I'll change to that I'll get another error: Fuel\Core\PhpErrorException [ Notice ]: Undefined property: stdClass::$right_id Nearly similar to my own try. I've dumped $tracker[$index] and there is no $right_id.
$right_field you mean? It's a variable defined at the top of the method, and should contain the configured column name of the records right pointer (default 'right_id').
I used objects (stdClass) because your example used object notation. If that has to change, you need to change the use of stdClass to an array, and also every use of tracker then needs to use array notation instead of -> ...
on line 34 you have to remove "(object)". on line 46, 'children' should be $children. on line 27, 'left_field' should be $left_field. on line 28 and 71, 'right_field' should be $right_field.
Cosmetic details, which should not affect the outcome.
Are you not confused with multi-dimensional arrays?
Children will be one, the correct JSON notation for a multi-dimensional array is [] to define the array, and {} for every array element.
From what I can see, you did it correctly. You can do a Debug::dump() on the result of the method call to check, but I'm pretty sure it's going to be all arrays.