Upgrade to 3.8.2

This commit is contained in:
Bastian Allgeier
2022-11-15 13:26:12 +01:00
parent fe2baa1b7a
commit f9e812cb0c
45 changed files with 760 additions and 346 deletions

View File

@@ -84,26 +84,17 @@ class ContentTranslation
*/
public function content(): array
{
$parent = $this->parent();
if ($this->content === null) {
$this->content = $parent->readContent($this->code());
}
$content = $this->content;
$parent = $this->parent();
$content = $this->content ??= $parent->readContent($this->code());
// merge with the default content
if (
$this->isDefault() === false &&
$defaultLanguage = $parent->kirby()->defaultLanguage()
) {
$default = [];
if ($defaultTranslation = $parent->translation($defaultLanguage->code())) {
$default = $defaultTranslation->content();
if ($default = $parent->translation($defaultLanguage->code())?->content()) {
$content = array_merge($default, $content);
}
$content = array_merge($default, $content);
}
return $content;