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

get_smart_themes_nodes()

Description

get_smart_themes_nodes

Parameters

ColumnTypeDefaultDescription
$field integer
$is_category_tree boolean
$parent integer null
$field_meta array array - resource type field metadata

Return

array

Location

include/collections_functions.php lines 1890 to 1956

Definition

 
function get_smart_themes_nodes($field$is_category_tree$parent null, array $field_meta = array())
    {
    
$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(isset(
$field_meta['automatic_nodes_ordering']) && (bool) $field_meta['automatic_nodes_ordering'])
                {
                
$nodes reorder_nodes($nodes);
                
$nodes array_values($nodes); // reindex nodes array
                
}

    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] = 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 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 4th December 2024 08:35 Europe/London time based on the source file dated 27th November 2024 15:30 Europe/London time.