PHP Класс 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();
Показать файл
Открыть проект
Примеры использования класса
Открытые методы
Метод |
Описание |
|
__construct ( ) |
Constructor. |
|
save ( ) |
Saves (persists) the current setting values in the database. |
|
Защищенные методы
Метод |
Описание |
|
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 |
|
Описание методов
__construct()
публичный Метод
makeSetting()
защищенный Метод
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 |
Результат |
SystemSetting |
Returns an instance of the created measurable setting. |
makeSettingManagedInConfigOnly()
защищенный Метод
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 |
|
|
Результат |
SystemSetting |
|
Will trigger an event to notify plugins that a value has been changed.