diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-11-28 04:34:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 04:34:16 +0300 |
commit | 734f06480b1b6b104af191cb2c8beab0f52e7ee9 (patch) | |
tree | ebc679ad797fd0dbdb0e7784a641c481f9036052 /plugins/Dashboard/Dashboard.php | |
parent | 0cbf386349af33e2fba0fc28b4de14da9af3fd26 (diff) |
Small API changes needed for a translation plugin (#13766)
* introduce new api to get requested root api method
* fetch dashboards through API
Diffstat (limited to 'plugins/Dashboard/Dashboard.php')
-rw-r--r-- | plugins/Dashboard/Dashboard.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php index 3caf0d13f5..5f62a36ca8 100644 --- a/plugins/Dashboard/Dashboard.php +++ b/plugins/Dashboard/Dashboard.php @@ -8,6 +8,7 @@ */ namespace Piwik\Plugins\Dashboard; +use Piwik\API\Request; use Piwik\Common; use Piwik\Container\StaticContainer; use Piwik\Piwik; @@ -47,7 +48,7 @@ class Dashboard extends \Piwik\Plugin if (Piwik::isUserIsAnonymous()) { $this->addDefaultDashboard($widgets); } else { - $dashboards = API::getInstance()->getDashboards(); + $dashboards = $this->getDashboards(); if (empty($dashboards)) { $this->addDefaultDashboard($widgets); @@ -66,6 +67,14 @@ class Dashboard extends \Piwik\Plugin } } + private function getDashboards() + { + return Request::processRequest('Dashboard.getDashboards', + ['filter_limit' => '-1', 'filter_offset' => 0], + [] + ); + } + private function addDefaultDashboard(&$widgets) { $config = new WidgetConfig(); @@ -83,7 +92,7 @@ class Dashboard extends \Piwik\Plugin if (Piwik::isUserIsAnonymous()) { $this->addDefaultSubcategory($subcategories); } else { - $dashboards = API::getInstance()->getDashboards(); + $dashboards = $this->getDashboards(); if (empty($dashboards)) { $this->addDefaultSubcategory($subcategories); |