models/classes/creator/TreeItemLookup.php
private function formatTreeData(array $treeData)
    {
        return array_map(function($data){
            $formatted = [
                'categories' => $this->getCategoryService()->getItemCategories(new \core_kernel_classes_Resource($data['uri']))
            ];
            if(isset($data['children'])){
                $formatted['children'] = $this->formatTreeData($data['children']);
            }
            return array_merge($data, $formatted);
        }, $treeData);
    }
private function formatTreeData(array $treeData)
    {
        return array_map(function($data){
            $formatted = [
                'categories' => $this->getCategoryService()->getItemCategories(new \core_kernel_classes_Resource($data['uri']))
            ];
            if(isset($data['children'])){
                $formatted['children'] = $this->formatTreeData($data['children']);
            }
            return array_merge($data, $formatted);
        }, $treeData);
    }
private function formatTreeData ( array $ treeData ) { return array_map ( function ( $ data ) { $ formatted = [ 'categories' => $ this -> getCategoryService ( ) -> getItemCategories ( new \ core_kernel_classes_Resource ( $ data [ 'uri' ] ) ) ] ; if ( isset ( $ data [ 'children' ] ) ) { $ formatted [ 'children' ] = $ this -> formatTreeData ( $ data [ 'children' ] ) ; } return array_merge ( $ data , $ formatted ) ; } , $ treeData ) ; }
Reformat the the tree : state and count
Add the item's categories
@param array $treeData
@return array the formated data
Reformat the the tree : state and count Add the item s categories