Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

render_field_selector_question()

Parameters

ColumnTypeDefaultDescription
$label
$name
$ftypes
$class "stdwidth"
$hidden false
$current 0

Location

include/render_functions.php lines 3032 to 3061

Definition

 
function render_field_selector_question($label$name$ftypes$class "stdwidth"$hidden false$current 0)
    {
    global 
$lang;
    
$fieldtypefilter "";
    
$parameters = array();

    
// Check only valid field types supplied. An empty array is valid i.e. return all types.
    
$ftypes array_filter($ftypes, function($t) {global $field_types; return is_int($t) && in_array($tarray_keys($field_types));});
        
    if(
count($ftypes)>0)
        {
        
$fieldtypefilter " WHERE type IN (" ps_param_insert(count($ftypes)) . ")";
        
$parameters ps_param_fill($ftypes"i");
        }

    
$fields ps_query("SELECT " columns_in("resource_type_field") . " from resource_type_field " .  (($fieldtypefilter=="")?"":$fieldtypefilter) . " ORDER BY title, name"$parameters"schema");

    echo 
"<div class='Question' id='" escape($name) . "'" . ($hidden " style='display:none;border-top:none;'" "") . ">";
    echo 
"<label for='" escape($name) . "' >" escape($label) . "</label>";
    echo 
"<select name='" escape($name) . "' id='" escape($name) . "' class='" $class "'>";
    echo 
"<option value='' selected >" escape($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 21st May 2024 21:35 Europe/London time based on the source file dated 17th May 2024 16:45 Europe/London time.