From 5bfd555c510d6bf29544de0e1409d1d46002ab64 Mon Sep 17 00:00:00 2001 From: blackcoder87 Date: Tue, 23 Jan 2024 18:30:19 +0100 Subject: [PATCH] Issue 891: Add missing change (#906) https://github.com/IlchCMS/Ilch-2.0/issues/891 --- application/libraries/Ilch/Layout/Helper/Menu/Model.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/application/libraries/Ilch/Layout/Helper/Menu/Model.php b/application/libraries/Ilch/Layout/Helper/Menu/Model.php index fa9f42cfa..84c50010e 100644 --- a/application/libraries/Ilch/Layout/Helper/Menu/Model.php +++ b/application/libraries/Ilch/Layout/Helper/Menu/Model.php @@ -157,6 +157,13 @@ public function getItems(string $tpl = '', array $options = []): string continue; } $box = $this->boxMapper->getSelfBoxByIdLocale($item->getBoxId(), $locale); + + if (!$box) { + // Get box without locale if no box with the requested locale was found. Display an "unlocalized" + // one instead of failing with an error or showing nothing. + $box = $this->boxMapper->getSelfBoxByIdLocale($item->getBoxId()); + } + // purify content of user created box $contentHtml = $this->layout->purify($box->getContent()); } else {