-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* @link https://craftcms.com/ | ||
* @copyright Copyright (c) Pixel & Tonic, Inc. | ||
* @license https://craftcms.github.io/license/ | ||
*/ | ||
|
||
namespace craft\base; | ||
|
||
/** | ||
* SortableFieldInterface defines the common interface to be implemented by field classes that can be available as | ||
* sort options on element indexes. | ||
* | ||
* @author Pixel & Tonic, Inc. <[email protected]> | ||
* @since 3.2 | ||
*/ | ||
interface SortableFieldInterface | ||
{ | ||
// Public Methods | ||
// ========================================================================= | ||
|
||
/** | ||
* Returns the sort option array that should be included in the element’s | ||
* [[\craft\base\ElementInterface::sortOptions()|sortOptions()]] response. | ||
* | ||
* @return array | ||
*/ | ||
public function getSortOption(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
use craft\base\ElementInterface; | ||
use craft\base\Field; | ||
use craft\base\PreviewableFieldInterface; | ||
use craft\base\SortableFieldInterface; | ||
use craft\elements\db\ElementQuery; | ||
use craft\elements\db\ElementQueryInterface; | ||
use craft\helpers\DateTimeHelper; | ||
|
@@ -25,7 +26,7 @@ | |
* @author Pixel & Tonic, Inc. <[email protected]> | ||
* @since 3.0 | ||
*/ | ||
class Date extends Field implements PreviewableFieldInterface | ||
class Date extends Field implements PreviewableFieldInterface, SortableFieldInterface | ||
{ | ||
// Static | ||
// ========================================================================= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
use Craft; | ||
use craft\base\ElementInterface; | ||
use craft\base\SortableFieldInterface; | ||
use craft\fields\data\SingleOptionFieldData; | ||
|
||
/** | ||
|
@@ -17,7 +18,7 @@ | |
* @author Pixel & Tonic, Inc. <[email protected]> | ||
* @since 3.0 | ||
*/ | ||
class Dropdown extends BaseOptionsField | ||
class Dropdown extends BaseOptionsField implements SortableFieldInterface | ||
{ | ||
// Static | ||
// ========================================================================= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
use craft\base\ElementInterface; | ||
use craft\base\Field; | ||
use craft\base\PreviewableFieldInterface; | ||
use craft\base\SortableFieldInterface; | ||
use yii\db\Schema; | ||
|
||
/** | ||
|
@@ -19,7 +20,7 @@ | |
* @author Pixel & Tonic, Inc. <[email protected]> | ||
* @since 3.0 | ||
*/ | ||
class Lightswitch extends Field implements PreviewableFieldInterface | ||
class Lightswitch extends Field implements PreviewableFieldInterface, SortableFieldInterface | ||
{ | ||
// Static | ||
// ========================================================================= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
use craft\base\ElementInterface; | ||
use craft\base\Field; | ||
use craft\base\PreviewableFieldInterface; | ||
use craft\base\SortableFieldInterface; | ||
use craft\helpers\Db; | ||
use craft\helpers\Localization; | ||
use craft\i18n\Locale; | ||
|
@@ -21,7 +22,7 @@ | |
* @author Pixel & Tonic, Inc. <[email protected]> | ||
* @since 3.0 | ||
*/ | ||
class Number extends Field implements PreviewableFieldInterface | ||
class Number extends Field implements PreviewableFieldInterface, SortableFieldInterface | ||
{ | ||
// Static | ||
// ========================================================================= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
use Craft; | ||
use craft\base\ElementInterface; | ||
use craft\base\SortableFieldInterface; | ||
use craft\fields\data\SingleOptionFieldData; | ||
|
||
/** | ||
|
@@ -17,7 +18,7 @@ | |
* @author Pixel & Tonic, Inc. <[email protected]> | ||
* @since 3.0 | ||
*/ | ||
class RadioButtons extends BaseOptionsField | ||
class RadioButtons extends BaseOptionsField implements SortableFieldInterface | ||
{ | ||
// Static | ||
// ========================================================================= | ||
|