mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Fixes a bug in report container not loading defaults and ignoring context
This commit is contained in:
parent
e69be53317
commit
8e3d3d5e30
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user