queueFilter('ReplaceSummaryRowLabel', array(Piwik::translate('General_Others'))); * * @api */ class ReplaceSummaryRowLabel extends BaseFilter { /** * Constructor. * * @param DataTable $table The table that will eventually be filtered. * @param string|null $newLabel The new label for summary row. If null, defaults to * `Piwik::translate('General_Others')`. */ public function __construct($table, $newLabel = null) { parent::__construct($table); if (is_null($newLabel)) { $newLabel = Piwik::translate('General_Others'); } $this->newLabel = $newLabel; } /** * See {@link ReplaceSummaryRowLabel}. * * @param DataTable $table */ public function filter($table) { $row = $table->getRowFromId(DataTable::ID_SUMMARY_ROW); if ($row) { $row->setColumn('label', $this->newLabel); } else { $row = $table->getRowFromLabel(DataTable::LABEL_SUMMARY_ROW); if ($row) { $row->setColumn('label', $this->newLabel); } } // recurse foreach ($table->getRowsWithoutSummaryRow() as $row) { $subTable = $row->getSubtable(); if ($subTable) { $this->filter($subTable); } } } }