diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-10 01:03:15 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-10 01:03:15 +0400 |
commit | e6607932067a0614f40c31d05990f8f5e9e358f5 (patch) | |
tree | 80901651bd7d6cdcfcad1ba6c3265666e66fe74c /core/WidgetsList.php | |
parent | 52d0f24eea594e35c365a392c3d2ef69ca55dedd (diff) |
fix tests
Diffstat (limited to 'core/WidgetsList.php')
-rw-r--r-- | core/WidgetsList.php | 14 |
1 files changed, 10 insertions, 4 deletions
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; } } |