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 1996 to 2008

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 5th May 2024 18:35 Europe/London time based on the source file dated 3rd May 2024 14:45 Europe/London time.