From 405be1a6edf55f01ac416562df6da01e2d65c61f Mon Sep 17 00:00:00 2001 From: Ro Date: Wed, 5 Apr 2023 15:16:30 -0700 Subject: [PATCH] Emplty Layout Hotfix When creating new pages, there is no layout, so the system was pushing a null error when trying to use string_contains and a null string, so cleaned that up so it defaults to 'page' when that string is empty --- brain/controller/DashControl.php | 3 +++ brain/data/Render.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/brain/controller/DashControl.php b/brain/controller/DashControl.php index 521900a..13b0921 100644 --- a/brain/controller/DashControl.php +++ b/brain/controller/DashControl.php @@ -112,6 +112,9 @@ class DashControl case 'edit': $page = (new Book())->findPageById($uuid); $views = []; + if (!isset($page['layout'])) { + $page['layout'] = "page"; + } if (str_contains($page['layout'], 'index')) { $views = (new Themes())->getCustomIndex(); } else { diff --git a/brain/data/Render.php b/brain/data/Render.php index d0be3a6..9ed923b 100644 --- a/brain/data/Render.php +++ b/brain/data/Render.php @@ -107,7 +107,7 @@ class Render } $template = $layout . '.twig'; - if (str_contains($page['layout'], 'index')) { + if (str_contains($layout, 'index')) { $location = '../public/index.html'; $dir = null; } else {