diff --git a/system/blueprints/pages/new.yaml b/system/blueprints/pages/new.yaml index e180fb3d1..29f36b729 100644 --- a/system/blueprints/pages/new.yaml +++ b/system/blueprints/pages/new.yaml @@ -9,20 +9,22 @@ form: title: type: text - label: Title + label: Page Title validate: required: true folder: type: text - label: Folder + label: Folder Name validate: type: slug required: true + + route: type: select - label: Parent + label: Parent Page classes: fancy @data-options: '\Grav\Common\Page\Pages::parents' @data-default: '\Grav\Plugin\admin::route' @@ -34,7 +36,7 @@ form: type: type: select classes: fancy - label: Page Type + label: Display Template default: default @data-options: '\Grav\Common\Page\Pages::types' validate: diff --git a/system/blueprints/pages/raw.yaml b/system/blueprints/pages/raw.yaml index 3b480294f..adfd0bd91 100644 --- a/system/blueprints/pages/raw.yaml +++ b/system/blueprints/pages/raw.yaml @@ -67,7 +67,7 @@ form: type: type: select classes: fancy - label: Page Type + label: Display Template default: default @data-options: '\Grav\Common\Page\Pages::types' validate: diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 54adf6daf..e0f89ffca 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -30,6 +30,11 @@ class Page { use GravTrait; + const ALL_PAGES = 0; // both standard and modular pages + const STANDARD_PAGES = 1; // visible and invisible pages (e.g. 01.regular/, invisible/) + const MODULAR_PAGES = 2; // modular pages (e.g. _modular/) + + /** * @var string Filename. Leave as null if page is folder. */ @@ -1131,17 +1136,17 @@ class Page * @param bool $modular|null whether or not to return modular children * @return Collection */ - public function children($modular = false) + public function children($type = Page::ALL_PAGES) { /** @var Pages $pages */ $pages = self::$grav['pages']; $children = $pages->children($this->path()); // Filter out modular pages on regular call - // Filter out non-modular pages when al you want is modular + // Filter out non-modular pages when all you want is modular foreach ($children as $child) { $is_modular_page = $child->modular(); - if (($modular && !$is_modular_page) || (!$modular && $is_modular_page)) { + if (($is_modular_page && $type == Page::STANDARD_PAGES) || (!$is_modular_page && $type == Page::MODULAR_PAGES)) { $children->remove($child->path()); } } @@ -1474,10 +1479,10 @@ class Page if (!empty($parts)) { switch ($parts[0]) { case 'modular': - $results = $this->children(true); + $results = $this->children(Page::MODULAR_PAGES); break; case 'children': - $results = $this->children(); + $results = $this->children(Page::NORMAL_PAGES); break; } }