Piwik\Settings\FieldConfig\

MultiPair

Lets you configure a multi pair field.

Usage:

$field->uiControl = FieldConfig::UI_CONTROL_MULTI_TUPLE; $field1 = new FieldConfig\MultiPair('Index', 'index', FieldConfig::UI_CONTROL_TEXT); $field2 = new FieldConfig\MultiPair('Value', 'value', FieldConfig::UI_CONTROL_TEXT); $field->uiControlAttributes['field1'] = $field1->toArray(); $field->uiControlAttributes['field2'] = $field2->toArray();

Properties

This class defines the following properties:

  • $key ash; The name of the key the index should have eg "dimension" will make an index array(array('dimension' => '.
  • $uiControl — Describes what HTML element should be used to manipulate the setting through Matomo (formerly Piwik)'s UI.
  • $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.

$key

The name of the key the index should have eg "dimension" will make an index array(array('dimension' => '.

..'))

Signature

  • It is a string value.

$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.

$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

    • $key

    • $uiControl

toArray()

Signature

  • It does not return anything or a mixed result.