diff options
Diffstat (limited to 'plugins/CustomVariables/CustomVariables.php')
-rw-r--r-- | plugins/CustomVariables/CustomVariables.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php index e5a13bc52a..c18eaf946c 100644 --- a/plugins/CustomVariables/CustomVariables.php +++ b/plugins/CustomVariables/CustomVariables.php @@ -23,6 +23,7 @@ class CustomVariables extends \Piwik\Plugin 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'Dimension.addDimensions' => 'addDimensions', 'Actions.getCustomActionDimensionFieldsAndJoins' => 'provideActionDimensionFields' ); } @@ -37,6 +38,24 @@ class CustomVariables extends \Piwik\Plugin Model::uninstall(); } + public function addDimensions(&$instances) + { + foreach (Model::getScopes() as $scope) { + $model = new Model($scope); + try { + $highestIndex = $model->getHighestCustomVarIndex(); + } catch (\Exception $e) { + continue; // ignore error for tests to work as this might be executed before Piwik tables are installed + } + + foreach (range(1, $highestIndex) as $index) { + $custom = new CustomDimension(); + $custom->initCustomDimension($index, $model); + $instances[] = $custom; + } + } + } + /** * There are also some hardcoded places in JavaScript * @return int |