Defining the options property used across many definitions.
Commonly, you may encounter the options, optionsMethod or optionsPreset property, this article describes in more detail how to configure options.
# Option Arrays
options property should specify the options directly as part of the definition as a key-value pair, where the value and label are independently specified.
options: draft: Draft published: Published archived: Archived
The keys can be integers with their label.
options: 1: Simple 2: Complex
In addition to a simple arrays, some fields such as radio lists support specifying a description as part of their
options values. This is where the value is defined as another array with the syntax
key: [label, description].
options: all: [All, Guests and customers will be able to access this page.] registered: [Registered only, Only logged in member will be able to access this page.] guests: [Guests only, Only guest users will be able to access this page.]
Other fields, such as dropdown fields support specifying an icon, image or color as part of their
options values. If the second item in the array starts with a
# then it is considered a color, and if the value contains a
. then it is considered an image, otherwise it is considered an icon class.
options: red: [Color, '#ff0000'] icon: [Icon, 'oc-icon-calendar'] image: [Image, '/path/to/image.png']
# Option Methods
optionsMethod property specifies a callable PHP method that can be used to request the available options. Typically the method name will refer to a method local to the associated model.
The method name can also be a static method on any object.
# Option Presets
optionsMethod property specifies a preset code that can be used to request the available options.
The following presets are available:
|icons||Lists available icon names (eg: |
|locales||Lists available locales (eg: |
|flags||Lists locales with their icons as flags (eg: |
|timezones||Lists available timezones (eg: |