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

config_single_ftype_select()

Description

Generate an html single-select + options block for selecting one of the RS field types. The
selected field type is posted as the value of the "ref" column of the selected field type.

Parameters

ColumnTypeDefaultDescription
$name string the name of the select block. Usually the name of the config variable being set.
$label string the user text displayed to label the select block. Usually a $lang string.
$current integer the current value of the config variable being set
$width integer 300 the width of the input field in pixels. Default: 300.
$rtype false
$ftypes array
$autosave false

Location

include/config_functions.php lines 1019 to 1063

Definition

 
function config_single_ftype_select($name$label$current$width=300$rtype=false$ftypes=array(), $autosave false)
    {
    global 
$lang;
    
$fieldtypefilter="";
    
$params = [];
    if(
count($ftypes)>0)
        {
        
$fieldtypefilter " type in ("ps_param_insert(count($ftypes)) .")";
        
$params ps_param_fill($ftypes'i');
        }
        
    if(
$rtype===false){
        
$fieldsps_query('select ' columns_in("resource_type_field") . ' from resource_type_field ' .  (($fieldtypefilter=="")?'':' where ' $fieldtypefilter) . ' order by title, name'$params"schema");
    }
    else{
        
$fieldsps_query("select " columns_in("resource_type_field") . " from resource_type_field where resource_type= ? " .  (($fieldtypefilter=="")?"":" and " $fieldtypefilter) . "order by title, name"array_merge(['i'$rtype], $params),"schema");
    }
?>
  <div class="Question">
    <label for=" echo $name?>" title=" echo str_replace('%cvn'$name$lang['plugins-configvar'])?>"> echo $label?></label>
    
     
    
if($autosave)
        {
        
?>
        <div class="AutoSaveStatus">
            <span id="AutoSaveStatus- echo $name?>" style="display:none;"></span>
        </div>
        
        
}
        
?>
    <select name=" echo $name?>" id=" echo $name?>" style="width: echo $width ?>px"
     if($autosave) { ?> onChange="AutoSaveConfigOption(' echo $name?>');" ?>>
    <option value=""  echo (($current=="")?' selected':''?>> echo $lang["select"]; ?></option>

    
foreach($fields as $field)
        {
        echo 
'    <option value="'$field['ref'] . '"' . (($current==$field['ref'])?' selected':'') . '>' lang_or_i18n_get_translated($field['title'],'fieldtitle-') . '</option>';
        }
?>
    </select>
  <div class="clearerleft"></div>
  </div>

    
}

This article was last updated 30th November 2023 16:35 Europe/London time based on the source file dated 10th November 2023 10:50 Europe/London time.