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_field_selector_question()

Parameters

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

Location

include/render_functions.php lines 3110 to 3139

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 17th November 2024 15:05 Europe/London time based on the source file dated 13th November 2024 14:05 Europe/London time.