AddSegmentByLabelMapping
This documentation is for an outdated Matomo version.
Click here if you want to read this article for the latest version.
Click here if you want to read this article for the latest version.
Piwik\DataTable\Filter\
AddSegmentByLabelMapping
Executes a filter for each row of a DataTable and generates a segment filter for each row.
It will map the label column to a segmentValue by searching for the label in the index of the given mapping array.
Basic usage example
$dataTable->filter('AddSegmentByLabelMapping', array('segmentName', array('1' => 'smartphone, '2' => 'desktop')));
Methods
The class defines the following methods:
__construct()filter()ash; See AddSegmentByLabelMapping.enableRecursive()ash; Enables/Disables recursive filtering. Inherited fromBaseFilterfilterSubTable()ash; Filters a row's subtable, if one exists and is loaded in memory. Inherited fromBaseFilter
__construct()
Signature
It accepts the following parameter(s):
$table(DataTable) —$segment(string) —$mapping(array) —
filter()
Signature
It accepts the following parameter(s):
$table(DataTable) —
It does not return anything or a mixed result.
enableRecursive()
Enables/Disables recursive filtering. Whether this property is actually used is up to the derived BaseFilter class.
Signature
It accepts the following parameter(s):
$enable(bool) —
It does not return anything or a mixed result.
filterSubTable()
Filters a row's subtable, if one exists and is loaded in memory.
Signature
- It accepts the following parameter(s):
$row(Row) — The row whose subtable should be filter.
- It does not return anything or a mixed result.