title: Photos
description: Simple Photo directory with Categories and Tags.
type: flex-objects
# Flex Configuration
config:
# Administration Configuration
admin:
# Admin router (optional)
router:
path: '/photos'
# Admin menu (optional)
menu:
list:
route: '/photos'
title: Photos
icon: fa-photo
# Authorization to collection admin
authorize: ['admin.photos.list', 'admin.super']
# Priority -10 .. 10 (highest goes up)
priority: 2
# Admin template type / folder
template: default
# Permissions
permissions:
# Primary permissions
admin.photos:
type: crudpl
label: Photos
# Preferences (defaults) - Available in Twig through 'directory.config.admin.collection.prefs' as an array.
collection:
prefs:
sort:
key: title
direction: ASC
tn:
size: 640
resize_method: 'resize' # [resize, cropResize, cropZoom]
ph:
size: 1600
resize_method: 'cropResize' # [resize, cropResize, cropZoom]
# List view
list:
title: title
fields:
published:
field:
type: toggle
label: Publ
width: 8
title:
link: edit
caption:
link: edit
test_tags:
# Edit View
edit:
title:
template: '[{{ object.photo|first.name ?? ''File Name'' }}] | {{ object.title ?? ''Title'' }} | {{ object.caption ?? ''no caption'' }}'
views:
# List view
list:
options:
per_page: 30 # Default number of items per page
order:
by: title # Default field used for ordering
dir: asc # Default ordering direction
# Preview View
preview:
enabled: false
route:
#template: '/plugins/flex-objects/directory:photos'
# Data Export
export:
enabled: true
method: 'jsonSerialize'
formatter:
class: 'Grav\Framework\File\Formatter\YamlFormatter'
filename: 'photos'
# Site Configuration
site:
templates:
collection:
# Lookup for the template layout files for collections of objects
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: photos
# 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\FolderStorage'
options:
formatter:
class: 'Grav\Framework\File\Formatter\YamlFormatter'
options:
file_extension: '.yaml'
inline: 5 # Save with up to 4 expanded levels
indent: 2 # Indent with 2 spaces
native: true # Use native YAML decoder if available
compat: true # If YAML cannot be decoded, use compatibility mode (SLOW)
folder: user-data://flex-photos
search:
# Search options
options:
contains: 1
# Fields to be searched
fields:
- title
- caption
- test_tags
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
photo:
type: file
multiple: false
accept:
- image/*
label: Photo
destination: self@
catalog_id:
type: text
label: Catalog ID
validate:
required: false
title:
type: text
label: Title
validate:
required: true
caption:
type: text
label: Caption
validate:
required: false
author:
type: text
label: Author
test_tags:
type: selectize
size: large
label: Test Tags
classes: fancy
validate:
type: commalist
categories_and_tags:
type: taxonomy
label: Category and Tag
multiple: true
validate:
type: array
blueprints:
# Blueprint for configure view.
configure:
# We are inside TABS field.
fields:
# Add our own tab
preferences:
type: tab
title: Preferences
fields:
# Fields should be prefixed with object, collection etc..
# Available in Twig through 'directory.config.collection.prefs' as an array.
spacer.sorting:
type: spacer
title: Sorting
collection.prefs.sort.key:
type: select
size: small
label: Sorting field
classes: fancy
default: 'title'
options:
'title': 'Title'
'caption': 'Caption'
'catalog_id': 'Catalog ID'
collection.prefs.sort.direction:
type: select
size: small
label: Sorting direction
classes: fancy
default: 'ASC'
options:
'ASC': 'Ascending (A-Z)'
'DESC': 'Descending (Z-A)'
'catalog_id': 'Catalog ID'
spacer.thumbnails:
type: spacer
title: Thumbnails
collection.prefs.tn.size:
type: select
size: small
label: Thumbnail Size in px
classes: fancy
default: '640'
options:
'80': '80 px'
'120': '120 px'
'160': '160 px'
'200': '200 px'
'240': '240 px'
'300': '300 px'
'360': '360 px'
'480': '480 px'
'640': '640 px'
'720': '720 px'
'800': '800 px'
'1000': '1000 px'
'1200': '1200 px'
'1600': '1600 px'
'2400': '2400 px'
'3000': '3000 px'
collection.prefs.tn.resize_method:
type: select
size: medium
label: Resize method
classes: fancy
default: 'resize'
options:
'resize': 'resize'
'cropResize': 'cropResize'
'cropZoom': 'cropZoom'
spacer.fullsize:
type: spacer
title: Full size images
collection.prefs.ph.size:
type: select
size: small
label: Photo Size in px
help: set to "Disabled" to disable Lightbox
classes: fancy
default: '1600'
options:
'1000': '1000 px'
'1200': '1200 px'
'1600': '1600 px'
'2000': '2000 px'
'2400': '2400 px'
'3000': '3000 px'
'none': 'Disabled'
collection.prefs.ph.resize_method:
type: select
size: medium
label: Resize method
classes: fancy
default: 'cropResize'
options:
'resize': 'resize'
'cropResize': 'cropResize'
'cropZoom': 'cropZoom'