diff --git a/code/model/editableformfields/EditableOption.php b/code/model/editableformfields/EditableOption.php index 16812f5..7cce556 100644 --- a/code/model/editableformfields/EditableOption.php +++ b/code/model/editableformfields/EditableOption.php @@ -114,4 +114,15 @@ class EditableOption extends DataObject { public function canUnpublish($member = null) { return $this->canDelete($member); } + + /** + * + */ + protected function onBeforeWrite() { + if (!$this->Sort) { + $this->Sort = EditableOption::get()->max('Sort') + 1; + } + + parent::onBeforeWrite(); + } }