Skip to content

Commit

Permalink
Don't break when retrieving unknown site-wide text pages
Browse files Browse the repository at this point in the history
  • Loading branch information
CatoTH committed Sep 15, 2024
1 parent becb984 commit 29f91e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion models/db/ConsultationText.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions views/pages/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down

0 comments on commit 29f91e1

Please sign in to comment.