We found that in the get() function in LayoutProvider it was returning the default behaviour before it was checking the modules for overrrides.
Just changing around a few lines so it checks the modules before the default has fixed it.
Old function:
New function
Just changing around a few lines so it checks the modules before the default has fixed it.
Old function:
Code:
public function get(string $scope, string $name): ?string
{
if (
$this->sanitizeInput($scope) !== $scope ||
$this->sanitizeInput($name) !== $name
) {
throw new RuntimeException("Bad parameters.");
}
$path = 'layouts/' . $scope . '/' . $name . '.json';
$params = FileReaderParams::create()->withScope($scope);
$module = $this->getLayoutLocationModule($scope, $name);
if ($module) {
$params = $params
->withScope(null)
->withModuleName($module);
}
if ($this->fileReader->exists($path, $params)) {
return $this->fileReader->read($path, $params);
}
$default = $this->getDefault($scope, $name);
if ($default) {
return $default;
}
foreach (array_reverse($this->metadata->getModuleList()) as $module) {
$params = FileReaderParams::create()->withModuleName($module);
if ($this->fileReader->exists($path, $params)) {
return $this->fileReader->read($path, $params);
}
}
return null;
}
Code:
public function get(string $scope, string $name): ?string
{
if (
$this->sanitizeInput($scope) !== $scope ||
$this->sanitizeInput($name) !== $name
) {
throw new RuntimeException("Bad parameters.");
}
$path = 'layouts/' . $scope . '/' . $name . '.json';
$params = FileReaderParams::create()->withScope($scope);
$module = $this->getLayoutLocationModule($scope, $name);
if ($module) {
$params = $params
->withScope(null)
->withModuleName($module);
}
if ($this->fileReader->exists($path, $params)) {
return $this->fileReader->read($path, $params);
}
foreach (array_reverse($this->metadata->getModuleList()) as $module) {
$params = FileReaderParams::create()->withModuleName($module);
if ($this->fileReader->exists($path, $params)) {
return $this->fileReader->read($path, $params);
}
}
$default = $this->getDefault($scope, $name);
if ($default) {
return $default;
}
return null;
}

Comment