From 9a751011e2f30646a29d29c1457929f96f6ae44c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Gu=CC=88nther?= Date: Thu, 7 Jan 2021 09:44:10 +0100 Subject: [PATCH] Add draft token check to modules method --- index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index e18a062..69688f8 100755 --- a/index.php +++ b/index.php @@ -21,8 +21,6 @@ 'pageMethods' => [ 'renderModules' => function () { foreach ($this->modules() as $module) { - if (!$module->isListed() && !$module->isDraft()) continue; - if ($module->isDraft && !$module->isVerified(get('token'))) continue; $moduleTemplate = new Template($module->intendedTemplate()); echo $moduleTemplate->render([ 'page' => $this, @@ -39,11 +37,13 @@ }, 'modules' => function () { $modules = new ModulesCollection; - if ($rawModules = $this->find('modules')) { - $modules = $modules->merge($rawModules->childrenAndDrafts()->data()); + foreach($rawModules->childrenAndDrafts() as $module) { + if (!$module->isListed() && !$module->isDraft()) continue; + if ($module->isDraft && !$module->isVerified(get('token'))) continue; + $modules->append($module); + } } - return $modules; }, 'isModule' => function () {