From 29f91e16f5a880ff4e63358a09f892e474b4aeda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Ho=CC=88=C3=9Fl?= Date: Sun, 15 Sep 2024 18:22:52 +0200 Subject: [PATCH] Don't break when retrieving unknown site-wide text pages --- models/db/ConsultationText.php | 2 +- views/pages/list.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/models/db/ConsultationText.php b/models/db/ConsultationText.php index 0c312c035a..d707915ebe 100644 --- a/models/db/ConsultationText.php +++ b/models/db/ConsultationText.php @@ -268,7 +268,7 @@ public static function getMenuEntries(?Site $site, ?Consultation $consultation): public static function getPageData(?Site $site, ?Consultation $consultation, string $pageKey): ConsultationText { $foundText = null; - if (!in_array($pageKey, static::getSitewidePages())) { + if (!in_array($pageKey, static::getSitewidePages()) && $consultation) { foreach ($consultation->texts as $text) { if ($text->category === self::DEFAULT_CATEGORY && mb_strtolower($text->textId) === mb_strtolower($pageKey)) { $foundText = $text; diff --git a/views/pages/list.php b/views/pages/list.php index 5fd49c9679..6f25812f24 100644 --- a/views/pages/list.php +++ b/views/pages/list.php @@ -54,6 +54,7 @@ foreach ($missing as $textId => $title) { if ($textId === 'feeds') { $url = \app\components\UrlHelper::createUrl(['consultation/feeds']); + $options = []; } else { $params = ['pages/show-page', 'pageSlug' => $textId]; if (!in_array($textId, ConsultationText::getSitewidePages())) {