Piwik\Settings\Plugin\

SystemSetting

Describes a system wide setting.

See Setting.

Methods

The class defines the following methods:

__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

getName()

Get the name of the setting.

Signature

  • It returns a string value.

getType()

Get the PHP type of the setting.

Signature

  • It returns a string value.

getDefaultValue()

Signature

  • It returns a mixed value.

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 bool value.

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

Signature

  • It returns a 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.

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.