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

get_node_elements()

Description

This function returns an array containing list of values for a selected field, identified by $field_label, in the multidimensional array $nodes

Parameters

ColumnTypeDefaultDescription
$node_values array - list of values for a selected field in the node tree
$nodes array - node tree to parse
$field_label string - node field to retrieve value of and add to array $node_values

Return

array $node_values

Location

include/node_functions.php lines 2011 to 2023

Definition

 
function get_node_elements(array $node_values, array $nodes$field_label)
{    
    if (isset(
$nodes[0])) {
        foreach (
$nodes as $node) {
            if (isset(
$node["name"])) {
                
array_push($node_values$node[$field_label]);
            }   
            
$node_values = (isset($node["children"])) ? get_node_elements($node_values$node["children"], $field_label)  :  get_node_elements($node_values$node$field_label); 
        }
    }
    
    return 
$node_values;
}

This article was last updated 22nd July 2024 21:35 Europe/London time based on the source file dated 8th July 2024 10:20 Europe/London time.