Piwik\Settings\Plugin\
Describes a system wide setting.
See Setting.
The class defines the following methods:
__construct()
— Constructor.getName()
ash; Get the name of the setting. Inherited from Setting
getType()
ash; Get the PHP type of the setting. Inherited from Setting
getDefaultValue()
Inherited from Setting
setDefaultValue()
ash; Sets/overwrites the current default value Inherited from Setting
setIsWritableByCurrentUser()
ash; Set whether setting is writable or not. Inherited from Setting
isWritableByCurrentUser()
— Returns true
if this setting is writable for the current user, false
if otherwise.save()
ash; Saves (persists) the value for this setting in the database if a value has been actually set. Inherited from Setting
getValue()
setValue()
ash; Sets and persists this setting's value overwriting any existing value. Inherited from Setting
__construct()
Constructor.
$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 togetName()
Get the name of the setting.
string
value.getType()
Get the PHP type of the setting.
string
value.getDefaultValue()
mixed
value.setDefaultValue()
Sets/overwrites the current default value
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.
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.
bool
value.save()
Saves (persists) the value for this setting in the database if a value has been actually set.
getValue()
mixed
value.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.
It accepts the following parameter(s):
$value
(mixed
) —It does not return anything or a mixed result.
Exception
— If the current user is not allowed to change the value of this setting.