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

Description

Generate colour picker input

Parameters

ColumnTypeDefaultDescription
$name string HTML input name attribute
$label string
$current string Current value
$default string Default value
$title string null Title
$autosave boolean false Automatically save the value on change
$on_change_js null
$hidden false
on_change_js string JavaScript run onchange of value (useful for "live" previewing of changes)

Location

include/config_functions.php lines 676 to 732

Definition

 
function config_colouroverride_input($name$label$current$default$title=null$autosave=false$on_change_js=null$hidden=false)
    {
    global 
$lang;
    
$checked=$current && $current!=$default;
    if (
is_null($title))
        {
        
// This is how it was used on plugins setup page. Makes sense for developers when trying to debug and not much for non-technical users
        
$title str_replace('%cvn'$name$lang['plugins-configvar']);
        }
    
?><div class="Question" style="min-height: 1.5em;" id="question_ echo $name?> if ($hidden){echo "style=\"display:none;\"";} ?> >
        <label for=" echo $name?>" title=" echo $title?>"> echo $label?></label>
        <div class="AutoSaveStatus">
            <span id="AutoSaveStatus- echo $name?>" style="display:none;"></span>
        </div>
        <input type="checkbox"  if ($checked) { ?>checked="true"  ?>onchange="
            jQuery('#container_ echo $name?>').toggle();
            if(!this.checked)
            {
            jQuery('# echo $name?>').val(' echo $default?>');
         if ($autosave)
            {
            
?>AutoSaveConfigOption(' echo $name?>');
                jQuery('# echo $name?>').trigger('change');
            
            
}
        if(!empty(
$on_change_js))
            {
            echo 
$on_change_js;
            }
        
?>
            }
            " style="float: left;" />
        <div id="container_ echo $name?>" if (!$checked) { ?>style="display: none;"  ?>>
            <input id=" echo $name?>" name=" echo $name?>" type="text" value=" echo escape($current); ?>" onchange="
            
if ($autosave)
                {
                
?>AutoSaveConfigOption(' echo $name?>');
                
}
            if(!empty(
$on_change_js))
                {
                echo 
$on_change_js;
                }
            
?>" default=" echo $default?>" />
            <script>
                jQuery('# echo $name?>').spectrum({
                    showAlpha: true,
                    showInput: true,
                    clickoutFiresChange: true,
                    preferredFormat: 'rgb'
                });
            </script>
        </div>
        <div class="clearerleft"></div>
        </div>
        
    
    
}

This article was last updated 11th December 2024 20:35 Europe/London time based on the source file dated 11th December 2024 15:55 Europe/London time.