From 3d91b7874cc549ec80fbdd1d9d2e85174f9f4979 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Thu, 16 Jul 2015 18:04:35 +1000 Subject: [PATCH] Fixes a bug in report container not loading defaults and ignoring context --- modules/backend/widgets/ReportContainer.php | 23 +++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/modules/backend/widgets/ReportContainer.php b/modules/backend/widgets/ReportContainer.php index 01a63c0d0..9fc8fa83c 100644 --- a/modules/backend/widgets/ReportContainer.php +++ b/modules/backend/widgets/ReportContainer.php @@ -73,18 +73,23 @@ class ReportContainer extends WidgetBase /** * Constructor. */ - public function __construct($controller) + public function __construct($controller, $configuration = null) { - $configFile = 'config_' . snake_case($this->alias) . '.yaml'; - $path = $controller->getConfigPath($configFile); - if (File::isFile($path)) { - $config = $this->makeConfig($configFile); - } - else { - $config = []; + if (!$configuration) { + $configuration = 'config_report_container.yaml'; } - parent::__construct($controller, $config); + if (!is_array($configuration)) { + $path = $controller->getConfigPath($configuration); + if (File::isFile($path)) { + $configuration = $this->makeConfig($path); + } + else { + $configuration = []; + } + } + + parent::__construct($controller, $configuration); $this->bindToController(); $this->fillFromConfig();