mirror of
https://github.com/getgrav/grav.git
synced 2026-06-09 18:00:46 +02:00
Merge branch 'develop' of https://github.com/getgrav/grav into feature/multi-config
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user