diff options
author | Stefan Giehl <stefan@matomo.org> | 2019-04-20 00:14:58 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-04-20 00:14:58 +0300 |
commit | fc4cfd9c55fa9a3278bb919cc17cbaee1ba40499 (patch) | |
tree | ef35807091b51fa1e9f81fb7f41d9ac52d8039e0 /core | |
parent | dd5631d542373fc3e770d3e81a5597fd08ae52eb (diff) |
Adds new ViewDataTable.configure.end event (#14355)
* Adds new ViewDataTable.configure.end event after params have been overwritten by saved settings and query params
* changelog
Diffstat (limited to 'core')
-rw-r--r-- | core/Plugin/ViewDataTable.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/Plugin/ViewDataTable.php b/core/Plugin/ViewDataTable.php index 513d175d1f..b86ab95d7e 100644 --- a/core/Plugin/ViewDataTable.php +++ b/core/Plugin/ViewDataTable.php @@ -239,6 +239,9 @@ abstract class ViewDataTable implements ViewInterface * Triggered during {@link ViewDataTable} construction. Subscribers should customize * the view based on the report that is being displayed. * + * This event is triggered before view configuration properties are overwritten by saved settings or request + * parameters. Use this to define default values. + * * Plugins that define their own reports must subscribe to this event in order to * specify how the Piwik UI should display the report. * @@ -275,6 +278,31 @@ abstract class ViewDataTable implements ViewInterface $this->overrideViewPropertiesWithParams($overrideParams); $this->overrideViewPropertiesWithQueryParams(); + + /** + * Triggered after {@link ViewDataTable} construction. Subscribers should customize + * the view based on the report that is being displayed. + * + * This event is triggered after all view configuration values have been overwritten by saved settings or + * request parameters. Use this if you need to work with the final configuration values. + * + * Plugins that define their own reports can subscribe to this event in order to + * specify how the Piwik UI should display the report. + * + * **Example** + * + * // event handler + * public function configureViewDataTableEnd(ViewDataTable $view) + * { + * if ($view->requestConfig->apiMethodToRequestDataTable == 'VisitTime.getVisitInformationPerServerTime' + * && $view->requestConfig->flat == 1) { + * $view->config->show_header_message = 'You are viewing this report flattened'; + * } + * } + * + * @param ViewDataTable $view The instance to configure. + */ + Piwik::postEvent('ViewDataTable.configure.end', array($this)); } private function assignRelatedReportsTitle() |