From e6607932067a0614f40c31d05990f8f5e9e358f5 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Mon, 9 Jun 2014 23:03:15 +0200 Subject: fix tests --- core/WidgetsList.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'core/WidgetsList.php') diff --git a/core/WidgetsList.php b/core/WidgetsList.php index 75c75937d8..095c54cfd7 100644 --- a/core/WidgetsList.php +++ b/core/WidgetsList.php @@ -26,7 +26,7 @@ class WidgetsList extends Singleton * * @var array */ - static protected $widgets = null; + static protected $widgets = array(); /** * Indicates whether the hook was posted or not @@ -80,10 +80,11 @@ class WidgetsList extends Singleton Piwik::postEvent('WidgetsList.addWidgets'); /** @var \Piwik\Plugin\Widgets[] $widgets */ - $widgets = PluginManager::getInstance()->findComponents('Widgets', 'Piwik\\Plugin\\Widgets'); + $widgets = PluginManager::getInstance()->findComponents('Widgets', 'Piwik\\Plugin\\Widgets'); + $widgetsList = self::getInstance(); foreach ($widgets as $widget) { - $widget->configure(WidgetsList::getInstance()); + $widget->configure($widgetsList); } } } @@ -145,6 +146,11 @@ class WidgetsList extends Singleton } $widgetUniqueId .= $name . $value; } + + if (!array_key_exists($widgetCategory, self::$widgets)) { + self::$widgets[$widgetCategory] = array(); + } + self::$widgets[$widgetCategory][] = array( 'name' => $widgetName, 'uniqueId' => $widgetUniqueId, @@ -209,7 +215,7 @@ class WidgetsList extends Singleton */ public static function _reset() { - self::$widgets = null; + self::$widgets = array(); self::$hookCalled = false; } } -- cgit v1.2.3