diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-22 14:07:30 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-22 14:07:30 +0400 |
commit | 28d107b0d05f607a2ac9038cd0b52d8d223f098b (patch) | |
tree | 11727b009f6de233817edf254bed9e6e02e07702 /core/DataTable/Filter/MetadataCallbackReplace.php | |
parent | fe631813a815510a5a9a96a476deaab9444cb614 (diff) |
Refs #4200, removed Null filter and documented many more filters.
Diffstat (limited to 'core/DataTable/Filter/MetadataCallbackReplace.php')
-rw-r--r-- | core/DataTable/Filter/MetadataCallbackReplace.php | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/core/DataTable/Filter/MetadataCallbackReplace.php b/core/DataTable/Filter/MetadataCallbackReplace.php index 2f5b6f5548..bc326e3a14 100644 --- a/core/DataTable/Filter/MetadataCallbackReplace.php +++ b/core/DataTable/Filter/MetadataCallbackReplace.php @@ -14,20 +14,33 @@ use Piwik\DataTable; use Piwik\DataTable\Row; /** - * Replace a metadata value with a new value resulting - * from the function called with the metadata's value + * Execute a callback for each row of a DataTable using certain column values and metadata + * and replaces row metadata with the result. + * + * **Basic usage example** + * + * $dataTable->filter('MetadataCallbackReplace', array('url', function ($url) { + * return $url . '#index'; + * })); * * @package Piwik * @subpackage DataTable + * @api */ class MetadataCallbackReplace extends ColumnCallbackReplace { /** - * @param DataTable $table - * @param array|string $metadataToFilter - * @param callback $functionToApply - * @param null|array $functionParameters - * @param array $extraColumnParameters + * Constructor. + * + * @param DataTable $table The DataTable that will eventually be filtered. + * @param array|string $metadataToFilter The metadata whose values should be passed to the callback + * and then replaced with the callback's result. + * @param callable $functionToApply The function to execute. Must take the metadata value as a parameter + * and return a value that will be used to replace the original. + * @param array|null $functionParameters deprecated - use an [anonymous function](http://php.net/manual/en/functions.anonymous.php) + * instead. + * @param array $extraColumnParameters Extra column values that should be passed to the callback, but + * shouldn't be replaced. */ public function __construct($table, $metadataToFilter, $functionToApply, $functionParameters = null, $extraColumnParameters = array()) @@ -54,4 +67,4 @@ class MetadataCallbackReplace extends ColumnCallbackReplace { return $row->getMetadata($metadataToFilter); } -} +}
\ No newline at end of file |