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

config_multi_select()

Description

Generate an html multi-select + options block

used as the values of the options, and the values are the choices the user sees. (But see
$usekeys, below.) Usually a $lang entry whose value is an array of strings.
If set to false the values from $choices will be used for both the values of the options
and the text the user sees. Defaulted to true.

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
$choices
$usekeys boolean true tells whether to use the keys from $choices as the values of the options.
$width integer 300 the width of the input field in pixels. Default: 300.
array string $choices the array of choices -- the options in the select block. The keys are

Location

include/plugin_functions.php lines 700 to 715

Definition

 
function config_multi_select($name$label$current$choices$usekeys=true$width=300)
{
    global 
$lang;
    
?>
    <div class="Question">
        <label for=" echo $name?>" title=" echo escape(str_replace('%cvn'$name$lang['plugins-configvar'])); ?>"> echo escape($label); ?></label>
        <select name=" echo $name?>[]" id=" echo $name?>" class="MultiSelect" multiple="multiple"  if(count($choices) > 7) {echo ' size="7"';} ?> style="width: echo $width ?>px">
             foreach($choices as $key => $choice) {
                
$value $usekeys $key $choice;
                echo 
'    <option value="' $value '"' . ((in_array($value$current)) ? ' selected' '') . ">$choice</option>";
            } 
?>
        </select>
        <div class="clearerleft"></div>
    </div>
    
}

This article was last updated 23rd July 2024 21:35 Europe/London time based on the source file dated 23rd July 2024 16:15 Europe/London time.