SystemConfigSetting
Piwik\Settings\Plugin\
SystemConfigSetting
Describes a system wide setting.
See Setting.
Methods
The class defines the following methods:
__construct()— Constructor.getName()ash; Get the name of the setting. Inherited fromSettinggetType()ash; Get the PHP type of the setting. Inherited fromSettinggetDefaultValue()Inherited fromSettingsetDefaultValue()ash; Sets/overwrites the current default value Inherited fromSettingsetIsWritableByCurrentUser()ash; Set whether setting is writable or not. Inherited fromSettingisWritableByCurrentUser()— Returnstrueif this setting is writable for the current user,falseif otherwise.save()ash; Saves (persists) the value for this setting in the database if a value has been actually set. Inherited fromSettinggetValue()ash; Returns the previously persisted setting value. Inherited fromSettingsetValue()ash; Sets and persists this setting's value overwriting any existing value. Inherited fromSettinggetConfigSectionName()— Returns the config section the setting is for
__construct()
Constructor.
Signature
- It accepts the following parameter(s):
$name(string) — The setting's persisted name. Only alphanumeric characters are allowed, eg,'refreshInterval'.$defaultValue(mixed) — Default value for this setting if no value was specified.$type(string) — Eg an array, int, ... see SettingConfig::TYPE_* constants$pluginName(string) — The name of the plugin the setting belongs to$configSectionName
getName()
Get the name of the setting.
Signature
- It returns a
stringvalue.
getType()
Get the PHP type of the setting.
Signature
- It returns a
stringvalue.
getDefaultValue()
Signature
- It returns a
mixedvalue.
setDefaultValue()
Sets/overwrites the current default value
Signature
It accepts the following parameter(s):
$defaultValue(string) —
It does not return anything or a mixed result.
setIsWritableByCurrentUser()
Set whether setting is writable or not. For example to hide setting from the UI set it to false.
Signature
It accepts the following parameter(s):
$isWritable(bool) —
It does not return anything or a mixed result.
isWritableByCurrentUser()
Returns true if this setting is writable for the current user, false if otherwise. In case it returns
writable for the current user it will be visible in the Plugin settings UI.
Signature
- It returns a
boolvalue.
save()
Saves (persists) the value for this setting in the database if a value has been actually set.
Signature
- It does not return anything or a mixed result.
getValue()
Returns the previously persisted setting value. If no value was set, the default value is returned.
Signature
- It returns a
mixedvalue.
setValue()
Sets and persists this setting's value overwriting any existing value.
Before a value is actually set it will be made sure the current user is allowed to change the value. The value will be first validated either via a system built-in validate method or via a set FieldConfig::$validate custom method. Afterwards the value will be transformed via a possibly specified FieldConfig::$transform method. Before storing the actual value, the value will be converted to the actually specified $type.
Signature
It accepts the following parameter(s):
$value(mixed) —
It does not return anything or a mixed result.
- It throws one of the following exceptions:
Exception— If the current user is not allowed to change the value of this setting.
getConfigSectionName()
Returns the config section the setting is for
Signature
- It returns a
stringvalue.