NAME
Kernel::System::SysConfig::BaseValueType – Common system configuration value type backend functions.
PUBLIC INTERFACE
SettingEffectiveValueCheck()
Check if provided EffectiveValue matches structure defined in XMLContentParsed.
my %Result = $ValueTypeObject->SettingEffectiveValueCheck(
EffectiveValue => 'open',
XMLContentParsed => {
Value => [
{
'Item' => [
{
'Content' => "Scalar value",
},
],
},
],
},
);
Result: $Result = ( EffectiveValue => 'open', # Note for common ValueTypes EffectiveValue is not changed. Success => 1, Error => undef, );
EffectiveValueGet()
Extracts the effective value from a XML parsed setting.
my $EffectiveValue = $ValueTypeObject->EffectiveValueGet(
Value => [
{
ValueRegex => '', # (optional)
Content => 'TheEffectiveValue',
ValueType => 'AValueType', # (optional)
# ...
}
],
);
Returns:
$EffectiveValue = 'TheEffectiveValue';
ModifiedValueGet()
Returns parsed value with updated content(according to EffectiveValue).
my $ModifiedValue = $ValueTypeObject->ModifiedValueGet(
'EffectiveValue' => 'Item 1',
'Value' => [
{
'Item' => [
{
'Content' => 'Default value',
'ValueType' => 'String',
},
],
},
],
);
Returns:
$ModifiedValue = [
{
'Item' => [
{
'Content' => 'Item 1',
'ValueType' => 'String',
},
],
},
];
SettingRender()
Extracts the effective value from a XML parsed setting.
my $SettingHTML = $ValueTypeObject->SettingRender(
Name => 'SettingName',
EffectiveValue => 'Product 6', # (optional)
DefaultValue => 'Product 5', # (optional)
Class => 'My class' # (optional)
Item => [ # (optional) XML parsed item
{
'ValueType' => 'String',
'Content' => 'admin@example.com',
'ValueRegex' => '',
},
],
RW => 1, # (optional) Allow editing. Default 0.
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
Item => {
Content => 'Value',
},
},
);
Returns:
$HTML = "<input type='text' id='Setting_ExampleArray'
value='Value' name='ExampleArray' class='Entry'/>";
ValueAttributeGet()
Returns attribute name in the parsed XML that contains Value.
my $Result = $ValueTypeObject->ValueAttributeGet();
Result: $Result = 'Content';
DefaultItemAdd()
Return structure of the DefaultItem in case it's not inside of Array or Hash.
my $DefaultItem = $ValueTypeObject->DefaultItemAdd();
Returns:
$DefaultItem = undef;
# or
$DefaultItem = {
Item => {
Content => '',
},
ValueType => 'VacationDaysOneTime',
};
ForbiddenValueTypes()
Return array of value types that are not allowed inside this value type.
my @ForbiddenValueTypes = $ValueTypeObject->ForbiddenValueTypes();
Returns:
@ForbiddenValueTypes = (
'Option',
...
);
AddSettingContent()
Checks if a div with class 'SettingContent' should be added when adding new item to an array/hash in some special cases.
my $AddSettingContent = $ValueTypeObject->AddSettingContent();
Returns:
my $AddSettingContent = 1;