Checkbox#

NAME#

Kernel::System::SysConfig::ValueType::Checkbox - System configuration check-box value type backed.

PUBLIC INTERFACE#

new()#

Create an object. Do not use it directly, instead use:

use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new();
my $ValueTypeObject = $Kernel::OM->Get('Kernel::System::SysConfig::ValueType::Checkbox');

SettingEffectiveValueCheck()#

Check if provided EffectiveValue matches structure defined in XMLContentParsed.

my %Result = $ValueTypeObject->SettingEffectiveValueCheck(
    XMLContentParsed => {
        Value => [
            {
                'Item' => [
                    {
                        'Content'   => '1',
                        'ValueType' => 'Checkbox',
                    },
                ],
            },
        ],
    },
    EffectiveValue => '1',
);
Result:
%Result = (

EffectiveValue => ‘open’, # Note for Checkbox ValueTypes EffectiveValue is not changed. Success => 1, Error => undef,

);

SettingRender()#

Extracts the effective value from a XML parsed setting.

my $SettingHTML = $ValueTypeObject->SettingRender(
    Name           => 'SettingName',
    DefaultID      =>  123,             # (required)
    EffectiveValue => 'Product 6',
    DefaultValue   => 'Product 5',      # (optional)
    Class          => 'My class',       # (optional)
    RW             => 1,                # (optional) Allow editing. Default 0.
    Item           => [                 # (optional) XML parsed item
        {
            'ValueType' => 'Checkbox',
            'Content' => '1',
            'ValueRegex' => '',
        },
    ],
    IsArray => 1,                       # (optional) Item is part of the array
    IsHash  => 1,                       # (optional) Item is part of the hash
    IDSuffix => 1,                      # (optional) Suffix will be added to the element ID
    SkipEffectiveValueCheck => 1,       # (optional) If enabled, system will not perform effective value check.
                                        #            Default: 1.
);

Returns:

$SettingHTML = '<div class "Field"...</div>';

AddItem()#

Generate HTML for new array/hash item.

my $HTML = $ValueTypeObject->AddItem(
    Name           => 'SettingName',    (required) Name
    DefaultItem    => {                 (optional) DefaultItem hash, if available
        Content => 'Value',
        ValueType => 'Checkbox',
    },
    IDSuffix       => '_Array1',        (optional) IDSuffix is needed for arrays and hashes.
);

Returns:

$HTML = "<input type="checkbox" checked="checked" name="SettingName" value="1" id="SettingName_Array1">
    <input type="hidden" value="1" name="SettingName">
    <label for="SettingName_Array1" class='CheckboxLabel'>
        Enabled
    </label>";