Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

get_field_options()

Parameters

ColumnTypeDefaultDescription
$ref
$nodeinfo false

Location

include/resource_functions.php lines 6934 to 6968

Definition

 
function get_field_options($ref,$nodeinfo false)
    {
    
# For the field with reference $ref, return a sorted array of options. Optionally use the node IDs as array keys
    
if(!is_numeric($ref))
        {
        
$ref sql_value("select ref value from resource_type_field where name='" escape_check($ref) . "'","""schema");
        }
        
    
$options get_nodes($refnulltrue);
    
    
# Translate options, 
    
for ($m=0;$m<count($options);$m++)
        {
        
$options[$m]["name"] = i18n_get_translated($options[$m]["name"]);
        unset(
$options[$m]["resource_type_field"]); // Not needed
        
}
        
    if(!
$nodeinfo)
        {
        
$options array_column($options,"name");
        global 
$auto_order_checkbox,$auto_order_checkbox_case_insensitive;
        if (
$auto_order_checkbox)
            {
            if(
$auto_order_checkbox_case_insensitive)
                {
                
natcasesort($options);
                
$return=array_values($options);
                }
            else
                {
sort($options);}
            }
        }
        
    return 
$options;
    }

This article was last updated 11th July 2020 04:05 Europe/London time based on the source file dated 10th July 2020 16:06 Europe/London time.