PHP Класс Piwik\Settings\Measurable\MeasurableSettings
Descendants of this class should implement the {@link init()} method and call the
{@link makeSetting()} method for each of the measurable's settings.
For an example, see the {@link Piwik\Plugins\ExampleSettingsPlugin\MeasurableSettings} plugin.
$settingsProvider = new Piwik\Plugin\SettingsProvider(); // get this instance via dependency injection
$measurableSettings = $settingProvider->getMeasurableSettings($yourPluginName, $idsite, $idType = null);
$measurableSettings->yourSetting->getValue();
Показать файл
Открыть проект
Примеры использования класса
Защищенные свойства (Protected)
Открытые методы
Метод |
Описание |
|
__construct ( integer $idSite, string | null $idMeasurableType = null ) |
Constructor. |
|
save ( ) |
Saves (persists) the current measurable setting values in the database. |
|
Защищенные методы
Описание методов
__construct()
публичный Метод
public __construct ( integer $idSite, string | null $idMeasurableType = null ) |
$idSite |
integer |
If creating settings for a new site that is not created yet, use idSite = 0 |
$idMeasurableType |
string | null |
If null, idType will be detected from idSite |
hasMeasurableType()
защищенный Метод
makeProperty()
защищенный Метод
protected makeProperty ( $name, $defaultValue, $type, $configureCallback ) : MeasurableProperty |
$name |
|
|
$defaultValue |
|
|
$type |
|
|
$configureCallback |
|
|
Результат |
MeasurableProperty |
|
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 ) : MeasurableSetting |
$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 |
Результат |
MeasurableSetting |
Returns an instance of the created measurable setting. |
Will trigger an event to notify plugins that a value has been changed.
Описание свойств
$idMeasurableType защищенное свойство
protected string $idMeasurableType |
Результат |
string |
|
$idSite защищенное свойство
protected int $idSite |
Результат |
integer |
|