Skip to content

Instantly share code, notes, and snippets.

@Sulkar

Sulkar/news.yaml

Created Mar 31, 2020
Embed
What would you like to do?
title: News
description: News für die Startseite erstellen.
type: flex-objects
# Flex Configuration
config:
# Administration Configuration
admin:
# Admin router (optional)
router:
path: '/news'
# Admin menu (optional)
menu:
list:
route: '/news'
title: News
icon: fa-address-card-o
# Authorization to collection admin
authorize: ['admin.contacts.list', 'admin.super']
# Priority -10 .. 10 (highest goes up)
priority: 2
# Admin template type / folder
template: default
# Permissions
permissions:
# Primary permissions
admin.contacts:
type: crudpl
label: Contacts
# List view
list:
title: name
fields:
published:
field:
type: toggle
label: Publ
width: 8
title:
link: edit
info:
link:
# Edit View
edit:
title:
template: '{{ object.last_name ?? ''Last'' }}, {{ object.first_name ?? ''First Name'' }}'
# Preview View
preview:
enabled: false
route:
#template: '/plugins/flex-objects/directory:contacts'
# Data Export
export:
enabled: true
method: 'jsonSerialize'
formatter:
class: 'Grav\Framework\File\Formatter\YamlFormatter'
filename: 'news'
# Site Configuration
site:
templates:
collection:
# Lookup for the template layout files for collections of objects
# flex-objects/templates/flex/contacts/collection/default.html.twig
paths:
- 'flex/{TYPE}/collection/{LAYOUT}{EXT}'
object:
# Lookup for the template layout files for objects
paths:
- 'flex/{TYPE}/object/{LAYOUT}{EXT}'
defaults:
# Default template {TYPE}; overridden by filename of this blueprint if template folder exists
type: news
# Default template {LAYOUT}; can be overridden in render calls (usually Twig in templates)
layout: default
# Data Configuration
data:
# Object class to be used, allowing custom methods for the object
object: 'Grav\Common\Flex\Types\Generic\GenericObject'
# Collection class to be used, allowing custom methods for the collections
collection: 'Grav\Common\Flex\Types\Generic\GenericCollection'
# Index class to be used, works as a quick database-like lookup index
index: 'Grav\Common\Flex\Types\Generic\GenericIndex'
storage:
# Storage class, use single file storage (does not support images and assets)
class: 'Grav\Framework\Flex\Storage\SimpleStorage'
options:
formatter:
# File formatter class, in this case the file is stored in markdown
class: 'Grav\Framework\File\Formatter\JsonFormatter'
# JSON file where all the objects will be stored
folder: user-data://flex-objects/news.json
search:
# Search options
options:
contains: 1
# Fields to be searched
fields:
- last_name
- first_name
- email
form:
validation: loose
fields:
published:
type: toggle
label: Published
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.YES
0: PLUGIN_ADMIN.NO
validate:
type: bool
required: true
title:
type: text
label: Titel
validate:
required: true
info:
classes: frontmatter
type: editor
label: PLUGIN_ADMIN.FRONTMATTER
autofocus: true
codemirror:
mode: 'yaml'
indentUnit: 4
autofocus: true
indentWithTabs: false
lineNumbers: true
styleActiveLine: true
gutters: ['CodeMirror-lint-markers']
lint: true
link:
type: text
size: large
label: Link
date:
type: date
label: Datum
size: small
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.