diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-06 07:50:06 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-06 07:50:06 +0400 |
commit | bedfa1c9de069801d58de9642c92f8681c69d7bb (patch) | |
tree | 7abafc84eb446736dbe9df5f6c5e8d7b4d7aaf1f /core/WidgetsList.php | |
parent | b457fcc96885ae6a33896be4f1e98aec9efaf0fa (diff) |
working on simplifying widgets. Pushing into a branch since I am not 100% happy with it yet.
Diffstat (limited to 'core/WidgetsList.php')
-rw-r--r-- | core/WidgetsList.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/core/WidgetsList.php b/core/WidgetsList.php index bb85a37349..75c75937d8 100644 --- a/core/WidgetsList.php +++ b/core/WidgetsList.php @@ -8,6 +8,8 @@ */ namespace Piwik; +use Piwik\Plugin\Manager as PluginManager; + /** * Manages the global list of reports that can be displayed as dashboard widgets. * @@ -15,8 +17,9 @@ namespace Piwik; * event. Observers for this event should call the {@link add()} method to add reports. * * @api + * @method static \Piwik\WidgetsList getInstance() */ -class WidgetsList +class WidgetsList extends Singleton { /** * List of widgets @@ -71,20 +74,17 @@ class WidgetsList self::$hookCalled = true; /** - * Used to collect all available dashboard widgets. - * - * Subscribe to this event to make your plugin's reports or other controller actions available - * as dashboard widgets. Event handlers should call the {@link WidgetsList::add()} method for each - * new dashboard widget. - * - * **Example** - * - * public function addWidgets() - * { - * WidgetsList::add('General_Actions', 'General_Pages', 'Actions', 'getPageUrls'); - * } + * @ignore + * @deprecated */ Piwik::postEvent('WidgetsList.addWidgets'); + + /** @var \Piwik\Plugin\Widgets[] $widgets */ + $widgets = PluginManager::getInstance()->findComponents('Widgets', 'Piwik\\Plugin\\Widgets'); + + foreach ($widgets as $widget) { + $widget->configure(WidgetsList::getInstance()); + } } } |