Add pages with fields, a field schema and the screens to edit them
This commit is contained in:
1 parent
ce1a8a1370
commit
517039b625
19 files changed
+660
-13
No files matched your search
@@ -108,6 +108,20 @@ Files live on a Laravel filesystem disk (`manager.media.disk`); each row remembe
|
||||
`app(IriksIT\Manager\Support\MediaUsage::class)->register(fn () => $texts)`. Posts and Pages do.
|
||||
- No SVG: it can carry scripts.
|
||||
|
||||
## Pages module
|
||||
|
||||
Pages are texts with keys, so the public site reads them and the owner edits them without code. Define a page in `config/manager.php`:
|
||||
|
||||
```php
|
||||
'pages' => ['definitions' => ['home' => ['title' => 'Home', 'fields' => [
|
||||
'hero_title' => ['label' => 'Title on the photo', 'type' => 'text', 'default' => 'Welcome', 'max' => 120],
|
||||
'intro' => ['label' => 'Story', 'type' => 'markdown'],
|
||||
'photo' => ['label' => 'Photo', 'type' => 'media'],
|
||||
]]]],
|
||||
```
|
||||
|
||||
and read it with `IriksIT\Manager\Models\Page::contentFor('home')`: the stored values over the defaults, so a page that was never saved still has all its keys. Field types: `text`, `textarea`, `markdown`, `lines`, `media`, `url`, `number`, `date`, `toggle` and `select` (with `options`); `required`, `default`, `max`, `help` and `rules` work on all. The screens make the form, and the server validates and cleans every value by its type (a media or url value must be an address of the site or http(s)). A page without a definition is a free page with one Markdown text, a description for search engines and a publish switch; it can be made and removed in the screens. Permission: `pages.edit`. The definitions are shared code (`IriksIT\Manager\Support\Fields`), so other records can use them.
|
||||
|
||||
## Posts module
|
||||
|
||||
Posts written in Markdown, with drafts, scheduling, categories and tags.
|
||||
|
||||
Reference in new issue
Block a user