PHP Class Piwik\Settings\Plugin\SystemSettings

Descendants of this class should implement the {@link init()} method and call the {@link makeSetting()} method to create a system setting for this plugin. For an example, see {@link Piwik\Plugins\ExampleSettingsPlugin\SystemSettings}. $systemSettings = new Piwik\Plugins\ExampleSettingsPlugin\SystemSettings(); // get instance via dependency injection $systemSettings->yourSetting->getValue();
Inheritance: extends Piwik\Settings\Settings
Show file Open project: piwik/piwik Class Usage Examples

Public Methods

Method Description
__construct ( ) Constructor.
save ( ) Saves (persists) the current setting values in the database.

Protected Methods

Method Description
makeSetting ( string $name, mixed $defaultValue, string $type, Closure $fieldConfigCallback ) : SystemSetting Creates a new system setting.
makeSettingManagedInConfigOnly ( string $configSectionName, $name, $defaultValue, $type, $fieldConfigCallback ) : SystemSetting This is only meant for some core features used by some core plugins that are shipped with Piwik

Method Details

__construct() public method

Constructor.
public __construct ( )

makeSetting() protected method

Settings will be displayed in the UI depending on the order of makeSetting calls. This means you can define the order of the displayed settings by calling makeSetting first for more important settings.
protected makeSetting ( string $name, mixed $defaultValue, string $type, Closure $fieldConfigCallback ) : SystemSetting
$name string The name of the setting that shall be created
$defaultValue mixed The default value for this setting. Note the value will not be converted to the specified type.
$type string The PHP internal type the value of this setting should have. Use one of FieldConfig::TYPE_* constancts
$fieldConfigCallback Closure A callback method to configure the field that shall be displayed in the UI to define the value for this setting
return SystemSetting Returns an instance of the created measurable setting.

makeSettingManagedInConfigOnly() protected method

This is only meant for some core features used by some core plugins that are shipped with Piwik
protected makeSettingManagedInConfigOnly ( string $configSectionName, $name, $defaultValue, $type, $fieldConfigCallback ) : SystemSetting
$configSectionName string
$name
$defaultValue
$type
$fieldConfigCallback
return SystemSetting

save() public method

Will trigger an event to notify plugins that a value has been changed.
public save ( )