A simple selectbox field
The select field displays any number of options in a dropdown selectbox. This is perfect if you have lots of options, from which the user can just choose one.
fields:
category:
label: Category
type: select
options:
design: Design
architecture: Architecture
photography: Photography
3d: 3D
web: Web
fields:
category:
label: Category
type: select
default: architecture
options:
design: Design
architecture: Architecture
photography: Photography
3d: 3D
web: Web
Instead of defining options yourself, you can use an array of predefined dynamic ways to provide options:
fields:
category:
label: Category
type: select
default: architecture
options: children
Option | Description |
---|---|
children | List of options with all children |
visibleChildren | List of options with all visible children |
invisibleChildren | List of options with all invisible children |
pages | List of options with all pages of the site |
siblings | List of options with all siblings |
files | List of options with all files of the page |
images | List of options with all images of the page |
documents | List of options with all documents of the page |
videos | List of options with all videos of the page |
audio | List of options with all audio files of the page |
code | List of options with all code files of the page |
archives | List of options with all archives of the page |
An even more powerful way of generating dynamic options is the query option:
fields:
category:
label: Category
type: select
default: architecture
options: query
query:
page: downloads
fetch: files
value: '{{filename}}'
text: '{{filename}}'
flip: true
Option | Default | Description |
---|---|---|
page | current page | Any page URI. This is a powerful way to fetch any kind of data from any other page. |
fetch | children | See the list above for possible options |
value | {{uid}} | A string to be used for the value attribute. You can use {{varname}} for any object method from the passed object (page or file) |
text | {{title}} | A string to be used for the displayed option text. You can use {{varname}} for any object method from the passed object (page or file) |
flip | false | If true, the list of options will be reversed |
template | false | A template name that will filter out all items with a different intended template |