From d56b138464bcd95f3b723c042ab52dedd1452a92 Mon Sep 17 00:00:00 2001 From: Thomas Steur <thomas.steur@gmail.com> Date: Thu, 10 Oct 2013 00:51:19 +0000 Subject: [PATCH] added hooks for before and after load data table --- core/ViewDataTable.php | 6 ++++++ core/ViewDataTable/Visualization.php | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 05d62e4cc8..b8a2d8616f 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -1110,9 +1110,15 @@ class ViewDataTable $this->overrideViewProperties(); try { + + $visualization->beforeLoadDataTable(); + $this->loadDataTableFromAPI(); $this->postDataTableLoadedFromAPI(); $this->executeAfterDataLoadedCallbacks(); + + $visualization->afterLoadDataTable(); + } catch (NoAccessException $e) { throw $e; } catch (\Exception $e) { diff --git a/core/ViewDataTable/Visualization.php b/core/ViewDataTable/Visualization.php index 0eb4543d22..2920638979 100644 --- a/core/ViewDataTable/Visualization.php +++ b/core/ViewDataTable/Visualization.php @@ -14,6 +14,7 @@ namespace Piwik\ViewDataTable; use Piwik\DataTable; use Piwik\Piwik; use Piwik\View; +use Piwik\ViewDataTable; /** * Base class for all DataTable visualizations. Different visualizations are used to @@ -29,10 +30,16 @@ abstract class Visualization extends View protected $templateFile = ''; + /** + * @var ViewDataTable + */ + protected $viewDataTable; + public function __construct($view) { parent::__construct($this->templateFile); + $this->viewDataTable = $view; $this->init($view); } @@ -41,6 +48,16 @@ abstract class Visualization extends View // do your stuff here, do not overwrite constructor } + public function beforeLoadDataTable() + { + + } + + public function afterLoadDataTable() + { + + } + /** * Default implementation of getDefaultPropertyValues static function. * -- GitLab