Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

get_node_strings()

Description

This function returns an array of strings that represent the full paths to each tree node passed

Parameters

ColumnTypeDefaultDescription
$resource_nodes array - node tree to parse
$allnodes bool false - include paths to all nodes -if false will just include the paths to the end leaf nodes
$translate bool - translate strings?

Return

array $nodestrings - array of strings for all nodes passed in correct hierarchical order

Location

include/node_functions.php lines 2235 to 2252

Definition

 
function get_node_strings($resource_nodes,$allnodes false,$translate true): array
    {
    
// Arrange all passed nodes with parents first so that unnecessary paths can be removed
    
$orderednodes order_tree_nodes($resource_nodes);
    
// Create an array of all branch nodes for each node
    
$nodestrings = array();
    foreach(
$orderednodes as $resource_node)
        {
        
$path $translate $resource_node["translated_path"] : $resource_node["path"];
        if(!
$allnodes && isset($nodestrings[$resource_node["parent"]]))
            {
            unset(
$nodestrings[$resource_node["parent"]]);
            }
        
        
$nodestrings[$resource_node["ref"]] = $path;
        }
    return 
$nodestrings;
    }

This article was last updated 21st May 2024 21:35 Europe/London time based on the source file dated 14th May 2024 18:25 Europe/London time.