diff --git a/system/blueprints/pages/modular_raw.yaml b/system/blueprints/pages/modular_raw.yaml new file mode 100644 index 000000000..7a547d376 --- /dev/null +++ b/system/blueprints/pages/modular_raw.yaml @@ -0,0 +1,83 @@ +rules: + slug: + pattern: "[a-z][a-z0-9_\-]+" + min: 2 + max: 80 + +form: + fields: + + tabs: + type: tabs + active: 1 + + fields: + content: + type: tab + title: Content + + fields: + frontmatter: + type: frontmatter + label: Frontmatter + + + content: + type: markdown + label: Content + + uploads: + type: uploads + label: Page Media + + + options: + type: tab + title: Options + + fields: + + columns: + type: columns + + fields: + column1: + type: column + + fields: + + folder: + type: text + label: Folder Name + validate: + type: slug + required: true + + route: + type: select + label: Parent + classes: fancy + @data-options: '\Grav\Common\Page\Pages::parents' + @data-default: '\Grav\Plugin\admin::route' + options: + '/': '- Root -' + validate: + required: true + + type: + type: select + classes: fancy + label: Modular Template + default: default + @data-options: '\Grav\Common\Page\Pages::modularTypes' + validate: + required: true + + column2: + type: column + + fields: + order: + type: order + label: Ordering + diff --git a/system/src/Grav/Common/Page/Types.php b/system/src/Grav/Common/Page/Types.php index 4b17e86ea..69f61e597 100644 --- a/system/src/Grav/Common/Page/Types.php +++ b/system/src/Grav/Common/Page/Types.php @@ -53,7 +53,7 @@ class Types implements \ArrayAccess, \Iterator, \Countable } if (file_exists($path . 'modular/')) { foreach (Folder::all($path . 'modular/', $options) as $type) { - $this->register($type); + $this->register('modular/' . $type); } } } @@ -62,7 +62,7 @@ class Types implements \ArrayAccess, \Iterator, \Countable { $list = []; foreach ($this->items as $name => $file) { - if (strstr($name, '/')) { + if (strpos($name, '/')) { continue; } $list[$name] = ucfirst(strtr($name, '_', ' ')); @@ -75,10 +75,10 @@ class Types implements \ArrayAccess, \Iterator, \Countable { $list = []; foreach ($this->items as $name => $file) { - if (strstr($name, 'modular/') !== 0) { + if (strpos($name, 'modular/') !== 0) { continue; } - $list[$name] = trim(ucfirst(strtr($name, '_', ' '))); + $list[$name] = trim(ucfirst(strtr(basename($name), '_', ' '))); } ksort($list); return $list;