MetadataCallbackReplace
Click here if you want to read this article for the latest version.
Piwik\DataTable\Filter\
MetadataCallbackReplace
Execute a callback for each row of a DataTable passing certain column values and metadata as metadata, and replaces row metadata with the callback result.
Basic usage example
$dataTable->filter('MetadataCallbackReplace', array('url', function ($url) {
return $url . '#index';
}));
Methods
The class defines the following methods:
__construct()— Constructor.filter()ash; See ColumnCallbackReplace. Inherited fromColumnCallbackReplaceenableRecursive()ash; Enables/Disables recursive filtering. Inherited fromBaseFilterfilterSubTable()ash; Filters a row's subtable, if one exists and is loaded in memory. Inherited fromBaseFilter
__construct()
Constructor.
Signature
It accepts the following parameter(s):
$table(DataTable) —$metadataToFilter(array|string) — The metadata whose values should be passed to the callback and then replaced with the callback's result.$functionToApply(callable) — The function to execute. Must take the column value as a parameter and return a value that will be used to replace the original.$functionParameters(array|null) — deprecated - use an anonymous function instead.$extraColumnParameters(array) — Extra column values that should be passed to the callback, but shouldn't be replaced.
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.