From ccaf2c6b9665f238a61c9753f0b0e8c173557c77 Mon Sep 17 00:00:00 2001 From: Thomas Steur <thomas.steur@gmail.com> Date: Tue, 28 Jul 2015 12:51:51 +0000 Subject: [PATCH] added missing doc --- CHANGELOG.md | 2 +- core/Plugin/Report.php | 19 +++++++++++++++++++ .../dashboard/dashboard.directive.js | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8da1e313cb..dc1948bc77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API' * The class `Piwik\WidgetList` class has been moved to `Piwik\Widget\WidgetsList`. * The method `Piwik\Plugin\Menu::configureReportingMenu` has been removed. To add something to the reporting menu you need to create widgets * The method `Report::configureWidget()`, `Report::getWidgetTitle()` and `Report::configureReportingMenu()` have been removed, use the new method `Report::configureWidgets()` instead. -* The method `Report::getCategory()` does no longer return the translated category but the translation key of the category +* The method `Report::getCategory()` has been moved to `Report::getCategoryId()` and does no longer return the translated category but the translation key of the category. * The property `Report::$category` has been renamed to `Report::$categoryId` * The methods `Report::factory()`, `Report::getAllReportClasses()`, `Report::getAllReports` have been moved to the `Piwik\Plugin\Reports` class. * The properties `Report::$widgetTitle`, `Report::$widgetParams` and `Report::$menuTitle` were removed, use the method `Report::configureWidgets()` to create widgets instead diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php index 716bd92e31..c98d38e849 100644 --- a/core/Plugin/Report.php +++ b/core/Plugin/Report.php @@ -310,6 +310,25 @@ class Report return $view->render(); } + /** + * Let's you add any amount of widgets for this report. If a report defines a {@link $categoryId} and a + * {@link $subcategoryId} a widget will be generated automatically. + * + * Example to add a widget manually by overwriting this method in your report: + * $widgetsList->addWidgetConfig($factory->createWidget()); + * + * If you want to have the name and the order of the widget differently to the name and order of the report you can + * do the following: + * $widgetsList->addWidgetConfig($factory->createWidget()->setName('Custom')->setOrder(5)); + * + * If you want to add a widget to any container defined by your plugin or by another plugin you can do + * this: + * $widgetsList->addToContainerWidget($containerId = 'Products', $factory->createWidget()); + * + * @param WidgetsList $widgetsList + * @param ReportWidgetFactory $factory + * @api + */ public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) { if ($this->categoryId && $this->subcategoryId) { diff --git a/plugins/Dashboard/angularjs/dashboard/dashboard.directive.js b/plugins/Dashboard/angularjs/dashboard/dashboard.directive.js index 578737940c..b9db49f4b3 100644 --- a/plugins/Dashboard/angularjs/dashboard/dashboard.directive.js +++ b/plugins/Dashboard/angularjs/dashboard/dashboard.directive.js @@ -6,7 +6,7 @@ */ /** - * <div piwik-dashboard dashboardId="5" layout="10"></div> + * <div piwik-dashboard dashboard-id="5"></div> */ (function () { angular.module('piwikApp').directive('piwikDashboard', piwikDashboard); -- GitLab