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

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 706 to 738

Definition

 
function config_multi_select($name$label$current$choices$usekeys=true$width=300)
{
    global 
$lang;
    
?>
    <div class="Question">
        <label for=" echo escape($name);?>" title=" echo escape(str_replace('%cvn'$name$lang['plugins-configvar'])); ?>"> echo escape($label); ?></label>
        <fieldset
            name=" echo escape($name);?>[]"
            id=" echo escape($name);?>"
            class="MultiRTypeSelect"
            style="width: echo (int) $width?>px">
            <div class="MultiRtypeSelectContainer">
             foreach($choices as $key => $choice) {
                
$value $usekeys $key $choice?>
                <span id="option echo escape($value);?>">
                    <input
                        type="checkbox"
                        value=" echo escape($value); ?>"
                        name=" echo escape($name); ?>[]"
                        id=" echo escape($name.$choice); ?>"
                         echo (in_array($value$current)) ? ' checked="checked"' ''?>>
                         echo escape($choice);?>
                    </input>
                    <br />
                </span>
             ?>
            </div>
        </fieldset>

        <div class="clearerleft"></div>
    </div>
    
}

This article was last updated 17th November 2024 15:05 Europe/London time based on the source file dated 8th November 2024 11:50 Europe/London time.