SortableFieldInterface ​
- Type
- Interface
- Namespace
- craft\base
- Implemented by
- craft\fields\Date, craft\fields\Dropdown, craft\fields\Lightswitch, craft\fields\Money, craft\fields\Number, craft\fields\PlainText, craft\fields\RadioButtons, craft\fields\Range, craft\fields\Time
- Since
- 3.2.0
SortableFieldInterface defines the common interface to be implemented by field classes that can be available as sort options on element indexes.
Public Methods ​
Method | Description |
---|---|
getSortOption() | Returns the field’s sort option definition. |
getSortOption()
​
Returns the field’s sort option definition.
This should return an array with the following keys:
label
– The sort option labelorderBy
– An array or comma-delimited string of columns to order the query byattribute
– The table attribute name that this option is associated with (required iforderBy
is an array or more than one column name)