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.

Signature

  • It accepts the following parameter(s):
    • $table (DataTable) — The DataTable that will eventually be filtered.
    • $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 metadata 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()

See ColumnCallbackReplace.

Signature

  • It accepts the following parameter(s):

  • It does not return anything.