Piwik\Settings\FieldConfig\

ArrayField

Lets you configure a field for a field array.

Usage:

$field->uiControl = FieldConfig::UI_CONTROL_FIELD_ARRAY; $arrayField = new FieldConfig\ArrayField('Index', FieldConfig::UI_CONTROL_TEXT); $field->uiControlAttributes['field'] = $field->toArray();

Properties

This class defines the following properties:

  • $uiControl — Describes what HTML element should be used to manipulate the setting through Matomo (formerly Piwik)'s UI.
  • $customUiControlTemplateFile — Defines a custom template file for a UI control.
  • $customFieldComponent — Array like ['plugin' => 'MyPlugin', 'component' => 'MyExportedCustomFieldComponent'].
  • $title — This setting's display name, for example, 'Refresh Interval'.
  • $availableValues — The list of all available values for this setting.

$uiControl

Describes what HTML element should be used to manipulate the setting through Matomo's UI.

See Piwik\Plugin\Settings for a list of supported control types.

Signature

  • It is a string value.

$customUiControlTemplateFile

Defines a custom template file for a UI control. This file should render a UI control and expose the value in a "formField.value" angular model. For an example see "plugins/CorePluginsAdmin/angularjs/form-field/field-text.html"

Signature

  • It is a string value.

$customFieldComponent

Array like ['plugin' => 'MyPlugin', 'component' => 'MyExportedCustomFieldComponent']. For an example see "plugins/CorePluginsAdmin/vue/src/FormField/FieldText.vue"

Signature

  • It is a string[] value.

$title

This setting's display name, for example, 'Refresh Interval'.

Be sure to escape any user input as HTML can be used here.

Signature

  • It is a string value.

$availableValues

The list of all available values for this setting. If null, the setting can have any value.

If supplied, this field should be an array mapping available values with their prettified display value. Eg, if set to array('nb_visits' => 'Visits', 'nb_actions' => 'Actions'), the UI will display Visits and Actions, and when the user selects one, Matomo will set the setting to nb_visits or nb_actions respectively.

Signature

  • It can be one of the following types:
    • null
    • array

Methods

The class defines the following methods:

__construct()

Signature

  • It accepts the following parameter(s):

    • $title

    • $uiControl

toArray()

Signature

  • It does not return anything or a mixed result.