Fixes a bug in report container not loading defaults and ignoring context

This commit is contained in:
Samuel Georges 2015-07-16 18:04:35 +10:00
parent e69be53317
commit 8e3d3d5e30

View File

@ -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();