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

render_featured_collection_category_selector()

Description

Render the featured collection category selector

Parameters

ColumnTypeDefaultDescription
$parent integer Parent collection ref
$context array Contextual data (e.g depth level to render or the current branch path)

Return

void

Location

include/render_functions.php lines 4711 to 4780

Definition

 
function render_featured_collection_category_selector(int $parent, array $context)
    {
    global 
$lang;

    
// If this information is missing, that's an unrecoverable error, the developer should really make sure this information is provided
    
$collection $context["collection"]; # as returned by get_collection()
    
$depth = (int) $context["depth"];
    
$current_branch_path $context["current_branch_path"]; # as returned by get_featured_collection_category_branch_by_leaf()
    
$modal = (isset($context["modal"]) && is_bool($context["modal"]) ? $context["modal"] : false);

    
$featured_collection_categories get_featured_collection_categories($parent, array());
    if(empty(
$featured_collection_categories) && $depth>0)
        {
        return;
        }

    
$html_selector_name "selected_featured_collection_category_{$depth}";
    
$html_question_label_txt $lang["themecategory"] . ($depth == "" {$depth}");
    
?>
    <div class="Question">
        <label for=" echo $html_selector_name?>"> echo $html_question_label_txt?></label>
        
        $next_level_parent 
null;
        
?>
        <select id=" echo $html_selector_name?>" class="stdwidth" name=" echo $html_selector_name?>"
                onchange="featured_collection_category_select_onchange(this, document.getElementById('collectionform'));
                 echo $modal "Modal" "CentralSpace"?>Post(document.getElementById('collectionform'));">                
            <option value="0"> echo escape($lang["select"]); ?></option>
        
        
// Allow user to move FC category to the root. Because we don't expose the collection type to the user, this will
        // give users the ability to convert between public collection and featured category at root level without access
        // to the collection type.
        
if($depth == 0)
            {
            
$dummy_root_lvl_selected = ($collection["type"] == COLLECTION_TYPE_FEATURED && $parent == "selected" "");
            
?>
            <option value="root"  echo $dummy_root_lvl_selected?>> echo escape($lang["featured_collection_root_category"]); ?></option>
            
            
}
        foreach(
$featured_collection_categories as $fc_category)
            {
            
// Never show as an option the FC you're editing
            
if($fc_category["ref"] == $collection["ref"])
                {
                continue;
                }

            
$html_attr_selected "";
            if(isset(
$current_branch_path[$depth]) && $fc_category["ref"] == $current_branch_path[$depth]["ref"])
                {
                
$html_attr_selected "selected";
                
$next_level_parent $fc_category["ref"];
                }
            
?>
            <option value=" echo $fc_category["ref"]; ?> echo $html_attr_selected?>> echo escape(i18n_get_translated($fc_category["name"])); ?></option>
            
            
}
            
?>
        </select>
        <div class="clearerleft"></div>
    </div>
    
    
if(is_null($next_level_parent))
        {
        return;
        }

    
$context["depth"] = ++$depth;
    
render_featured_collection_category_selector($next_level_parent$context);
    }

This article was last updated 4th December 2024 08:35 Europe/London time based on the source file dated 3rd December 2024 11:55 Europe/London time.