SortableFieldInterface

Type
Interface
Namespace
craft\base
Implemented by
craft\fields\Date, craft\fields\Dropdown, craft\fields\Lightswitch, craft\fields\Number, craft\fields\PlainText, craft\fields\RadioButtons
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.

View source

# Public Methods

Method Description
getSortOption() Returns the field’s sort option configuration.

# getSortOption()

Returns the field’s sort option configuration.

This should return an array with the following keys:

  • label – The sort option label
  • orderBy – An array or comma-delimited string of columns to order the query by
  • attribute (optional) – The table attribute name that this option is associated with (required if orderBy is an array or more than one column name)

View source

Returns

array