Skip to content

Commit

Permalink
Add draft token check to modules method
Browse files Browse the repository at this point in the history
  • Loading branch information
medienbaecker committed Jan 7, 2021
1 parent f3312ee commit 9a75101
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 () {
Expand Down

0 comments on commit 9a75101

Please sign in to comment.