diff --git a/CHANGELOG.md b/CHANGELOG.md index 91ccb8f3..9b91d0b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#bugfix) * Fixed parent field not working with regular pages + * Fixed visible state being lost when creating new pages [#1831](https://github.com/getgrav/grav-plugin-admin/issues/1831) # v1.10.0-rc.7 ## 03/05/2020 diff --git a/classes/plugin/Admin.php b/classes/plugin/Admin.php index 0cc435a2..5c35586d 100644 --- a/classes/plugin/Admin.php +++ b/classes/plugin/Admin.php @@ -1848,7 +1848,7 @@ class Admin $header = ['title' => $data['title']]; if (isset($data['visible'])) { - if ($data['visible'] === '' || $data['visible']) { + if ($data['visible'] === '') { // if auto (ie '') $pageParent = $page->parent(); $children = $pageParent ? $pageParent->children() : []; @@ -1860,8 +1860,8 @@ class Admin } } } - if ((int)$data['visible'] === 1 && !$page->order()) { - $header['visible'] = $data['visible']; + if (in_array($data['visible'], ["0", "1"])) { + $header['visible'] = (bool)$data['visible']; } }