Piwik\Plugins\API\ProcessedReport::removeEmptyColumns PHP Method

removeEmptyColumns() private method

Removes metrics from the list of columns and the report meta data if they are marked empty in the data table meta data.
private removeEmptyColumns ( &$columns, &$reportMetadata, $dataTable )
    private function removeEmptyColumns(&$columns, &$reportMetadata, $dataTable)
    {
        $emptyColumns = $dataTable->getMetadata(DataTable::EMPTY_COLUMNS_METADATA_NAME);
        if (!is_array($emptyColumns)) {
            return;
        }
        $columnsToRemove = $this->getColumnsToRemove();
        $columnsToKeep = $this->getColumnsToKeep();
        $columns = $this->hideShowMetricsWithParams($columns, $columnsToRemove, $columnsToKeep, $emptyColumns);
        if (isset($reportMetadata['metrics'])) {
            $reportMetadata['metrics'] = $this->hideShowMetricsWithParams($reportMetadata['metrics'], $columnsToRemove, $columnsToKeep, $emptyColumns);
        }
        if (isset($reportMetadata['metricsDocumentation'])) {
            $reportMetadata['metricsDocumentation'] = $this->hideShowMetricsWithParams($reportMetadata['metricsDocumentation'], $columnsToRemove, $columnsToKeep, $emptyColumns);
        }
    }