Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2019-08-04 19:56:58 +0300
committerGitHub <noreply@github.com>2019-08-04 19:56:58 +0300
commit8877f4adff3788e82cf69a7ac87ced376b1dd6fa (patch)
tree1ccd58a08b4ea1bafa240cf05dc1e549dd2cd924 /core
parent7f61f6b892d19a0987de1fe869430db448bfdd12 (diff)
Two small changes for GA importer (#14727)
* Add ignored Visualization.beforeRender event. * When creating datatables from blob rows, keep any existing metadata instead of overwriting everything. * Add some docs to the new event. * Update changelog.
Diffstat (limited to 'core')
-rw-r--r--core/Archive/DataTableFactory.php10
-rw-r--r--core/Plugin/Visualization.php13
2 files changed, 18 insertions, 5 deletions
diff --git a/core/Archive/DataTableFactory.php b/core/Archive/DataTableFactory.php
index 9c7deef31f..d46fb14a6e 100644
--- a/core/Archive/DataTableFactory.php
+++ b/core/Archive/DataTableFactory.php
@@ -271,7 +271,7 @@ class DataTableFactory
}
// set table metadata
- $table->setAllTableMetadata(array_merge(DataCollection::getDataRowMetadata($blobRow), $keyMetadata));
+ $table->setAllTableMetadata(array_merge($table->getAllTableMetadata(), DataCollection::getDataRowMetadata($blobRow), $keyMetadata));
if ($this->expandDataTable) {
$table->enableRecursiveFilters();
@@ -297,7 +297,7 @@ class DataTableFactory
foreach ($blobRow as $name => $blob) {
$newTable = DataTable::fromSerializedArray($blob);
- $newTable->setAllTableMetadata($tableMetadata);
+ $newTable->setAllTableMetadata(array_merge($newTable->getAllTableMetadata(), $tableMetadata));
$table->addTable($newTable, $name);
}
@@ -452,7 +452,7 @@ class DataTableFactory
$table = new DataTable\Simple();
if (!empty($data)) {
- $table->setAllTableMetadata(array_merge(DataCollection::getDataRowMetadata($data), $keyMetadata));
+ $table->setAllTableMetadata(array_merge($table->getAllTableMetadata(), DataCollection::getDataRowMetadata($data), $keyMetadata));
DataCollection::removeMetadataFromDataRow($data);
@@ -470,7 +470,7 @@ class DataTableFactory
$table->addRow(new Row(array(Row::COLUMNS => array($name => 0))));
}
- $table->setAllTableMetadata($keyMetadata);
+ $table->setAllTableMetadata(array_merge($table->getAllTableMetadata(), $keyMetadata));
}
$result = $table;
@@ -496,7 +496,7 @@ class DataTableFactory
$table = new DataTable();
}
- $table->setAllTableMetadata($metadata);
+ $table->setAllTableMetadata(array_merge($table->getAllTableMetadata(), $metadata));
$map->addTable($table, $this->prettifyIndexLabel(self::TABLE_METADATA_PERIOD_INDEX, $range));
$tables[$range] = $table;
diff --git a/core/Plugin/Visualization.php b/core/Plugin/Visualization.php
index b130f3c28e..e3a8b51bb1 100644
--- a/core/Plugin/Visualization.php
+++ b/core/Plugin/Visualization.php
@@ -190,7 +190,9 @@ class Visualization extends ViewDataTable
$this->applyFilters();
$this->addVisualizationInfoFromMetricMetadata();
$this->afterAllFiltersAreApplied();
+
$this->beforeRender();
+ $this->fireBeforeRenderHook();
$this->logMessageIfRequestPropertiesHaveChanged($requestPropertiesAfterLoadDataTable);
} catch (NoAccessException $e) {
@@ -723,6 +725,17 @@ class Visualization extends ViewDataTable
// eg $this->config->showFooterColumns = true;
}
+ private function fireBeforeRenderHook()
+ {
+ /**
+ * Posted immediately before rendering the view. Plugins can use this event to perform last minute
+ * configuration of the view based on it's data or the report being viewed.
+ *
+ * @param Visualization $view The instance to configure.
+ */
+ Piwik::postEvent('Visualization.beforeRender', [$this]);
+ }
+
private function makeDataTablePostProcessor()
{
$request = $this->buildApiRequestArray();