PHP Class Piwik\Settings\Plugin\UserSettings

Descendants of this class should implement the {@link init()} method and call the {@link addSetting()} method for each of the plugin's settings. For an example, see {@link Piwik\Plugins\ExampleSettingsPlugin\UserSettings}. $userSettings = new Piwik\Plugins\ExampleSettingsPlugin\UserSettings(); // get instance via dependency injection $userSettings->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, $configureCallback ) : UserSetting Creates a new user setting.

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, $configureCallback ) : UserSetting
$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
return UserSetting Returns an instance of the created measurable setting.

save() public method

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