Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

cattree_node_flatten()

Description

Helper function which adds child nodes after each flattened parent node

Parameters

ColumnTypeDefaultDescription
$node array Array of nodes each with a child node array

Return

array Array of nodes with child nodes flattened out after their respective parents

Location

include/node_functions.php lines 2228 to 2242

Definition

 
function cattree_node_flatten($node) {
    
# Build node being flattened                                            
    
$flat_element = array('ref' => (string) $node['ref'],
                        
'resource_type_field' => (string) $node['resource_type_field'],
                        
'name' => (string) $node['name'],
                        
'parent' => (string) $node['parent'],
                        
'order_by' => (string) $node['order_by'],
                        
'resource' => (string) $node['resource']);
    
# Append children after flattened node                                                                
    
$cumulative_entries = array($flat_element);
    foreach(
$node['children'] as $child) {
        
$cumulative_entries array_merge($cumulative_entriescattree_node_flatten($child));
    }
    return 
$cumulative_entries;
}

This article was last updated 4th April 2024 09:35 Europe/London time based on the source file dated 21st March 2024 15:45 Europe/London time.