Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

get_smart_themes_nodes()

Description

get_smart_themes_nodes

Parameters

ColumnTypeDefaultDescription
$field integer
$is_category_tree boolean
$parent integer null

Return

void

Location

include/collections_functions.php lines 1291 to 1354

Definition

 
function get_smart_themes_nodes($field$is_category_tree$parent null)
    {
    global 
$smart_themes_omit_archived;

    
$return = array();

    
// Determine if this should cascade onto children for category tree type
    
$recursive false;
    if(
$is_category_tree)
        {
        
$recursive true;
        }

    
$nodes get_nodes($field, ((== $parent) ? null $parent), $recursive);

    if(
=== count($nodes))
        {
        return 
$return;
        }
  
    
/*
    Tidy list so it matches the storage format used for keywords
    The translated version is fetched as each option will be indexed in the local language version of each option
    */
    
$options_base = array();
    for(
$n 0$n count($nodes); $n++)
        {
        
$options_base[$n] = escape_check(trim(mb_convert_case(i18n_get_translated($nodes[$n]['name']), MB_CASE_LOWER'UTF-8')));
        }
    
    
// For each option, if it is in use, add it to the return list
    
for($n 0$n count($nodes); $n++)
        {
        
//$cleaned_option_base = str_replace('-', ' ', $options_base[$n]);
        
$cleaned_option_base preg_replace('/\W/',' ',$options_base[$n]);      // replace any non-word characters with a space
        
$cleaned_option_base trim($cleaned_option_base);      // trim (just in case prepended / appended space characters)

        
$tree_node_depth    0;
        
$parent_node_to_use 0;
        
$is_parent          false;

        if(
is_parent_node($nodes[$n]['ref']))
            {
            
$parent_node_to_use $nodes[$n]['ref'];
            
$is_parent          true;

            
$tree_node_depth get_tree_node_level($nodes[$n]['ref']);

            if(!
is_null($parent) && is_parent_node($parent))
                {
                
$tree_node_depth--;
                }
            }

        
$c                       count($return);
        
$return[$c]['name']      = trim(i18n_get_translated($nodes[$n]['name']));
        
$return[$c]['indent']    = $tree_node_depth;
        
$return[$c]['node']      = $parent_node_to_use;
        
$return[$c]['is_parent'] = $is_parent;
        
$return[$c]['ref'] = $nodes[$n]['ref'];
        }

    return 
$return;
    }

This article was last updated 23rd November 2020 16:35 Europe/London time based on the source file dated 23rd November 2020 16:00 Europe/London time.