Piwik\DataTable\Filter\
Executes a callback for each row of a DataTable and adds the result to the row as a metadata value.
Basic usage example
// add a logo metadata based on the url metadata
$dataTable->filter('MetadataCallbackAddMetadata', array('url', 'logo', 'Piwik\Plugins\MyPlugin\getLogoFromUrl'));
The class defines the following methods:
__construct()
— Constructor.filter()
ash; See MetadataCallbackAddMetadata.enableRecursive()
ash; Enables/Disables recursive filtering. Inherited from BaseFilter
filterSubTable()
ash; Filters a row's subtable, if one exists and is loaded in memory. Inherited from BaseFilter
__construct()
Constructor.
It accepts the following parameter(s):
$table
(DataTable
) —
$metadataToRead
(string
|array
) —
The metadata to read from each row and pass to the callback.
$metadataToAdd
(string
) —
The name of the metadata to add.$functionToApply
(callable
) —
The callback to execute for each row. The result will be added as metadata with the name $metadataToAdd
.$applyToSummaryRow
(bool
) —
True if the callback should be applied to the summary row, false if otherwise.filter()
See MetadataCallbackAddMetadata.
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.
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.
$row
(Row
) —
The row whose subtable should be filter.