Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

render_field_selector_question()

Description

Renders a metadata field selector

Parameters

ColumnTypeDefaultDescription
$label string label for the field
$name string name of form select
$ftypes array array of field types to include
$class string "stdwidth" array CSS class to apply
$hidden boolean false optionally hide the question usng CSS display:none
$current array 0 Current selected value

Return

void

Location

include/render_functions.php lines 2648 to 2671

Definition

 
function render_field_selector_question($label$name$ftypes,$class="stdwidth",$hidden=false$current 0)
    {
    global 
$lang;
    
$fieldtypefilter "";
    if(
count($ftypes)>0)
        {
        
$fieldtypefilter " WHERE type IN ('" implode("','"$ftypes) . "')";
        }
        
    
$fields=sql_query("SELECT * from resource_type_field " .  (($fieldtypefilter=="")?"":$fieldtypefilter) . " ORDER BY title, name""schema");
    
    echo 
"<div class='Question' id='" $name "'" . ($hidden " style='display:none;border-top:none;'" "") . ">";
    echo 
"<label for='" htmlspecialchars($name) . "' >" htmlspecialchars($label) . "</label>";
    echo 
"<select name='" htmlspecialchars($name) . "' id='" htmlspecialchars($name) . "' class='" $class "'>";
    echo 
"<option value='' selected >" $lang["select"] . "</option>";
    foreach(
$fields as $field)
        {
        
$selected = ($field["ref"] == $current "selected" "");
        echo 
"<option value='{$field['ref']}{$selected}>" lang_or_i18n_get_translated($field['title'],'fieldtitle-') . "</option>";
        }
    echo 
"</select>";
    echo 
"<div class='clearerleft'></div>";
    echo 
"</div>";
    }

This article was last updated 15th July 2020 07:05 Europe/London time based on the source file dated 8th July 2020 11:40 Europe/London time.