Piwik\DataTable\Filter\
Filter that will remove columns from a DataTable using either a blacklist, allowlist or both.
This filter is used to handle the hideColumn and showColumn query parameters.
Basic usage example
$columnsToRemove = array('nb_hits', 'nb_pageviews');
$dataTable->filter('ColumnDelete', array($columnsToRemove));
$columnsToKeep = array('nb_visits');
$dataTable->filter('ColumnDelete', array(array(), $columnsToKeep));
This class defines the following constants:
APPEND_TO_COLUMN_NAME_TO_KEEP â Hack: when specifying "showColumns", sometimes we'd like to also keep columns that "look" like a given column,
without manually specifying all these columns (which may not be possible if column names are generated dynamically) Inherited from ColumnDelete
APPEND_TO_COLUMN_NAME_TO_KEEPColumn will be kept, if they match any name in the $columnsToKeep, or if they look like anyColumnToKeep__anythingHere
The class defines the following methods:
__construct() — Constructor.filter() ash; See ColumnDelete.enableRecursive() ash; Enables/Disables recursive filtering. Inherited from BaseFilterfilterSubTable() 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) —
$columnsToRemove (array|string) —
An array of column names or a comma-separated list of column names. These columns will be removed.
$columnsToKeep (array|string) —
An array of column names that should be kept or a comma-separated list of column names. Columns not in this list will be removed.$deleteIfZeroOnly (bool) —
If true, columns will be removed only if their value is 0.$deleteRecursive (bool) —
If true, columns will be removed in nested arrays.filter()See ColumnDelete.
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.