From 08646ad45eb9093942bafa743e0c73a6da57bb84 Mon Sep 17 00:00:00 2001 From: muskie9 Date: Thu, 21 Jul 2016 01:08:03 -0500 Subject: [PATCH] BUGFIX no Sort value applie to EditableOption on write --- code/model/editableformfields/EditableOption.php | 11 +++++++++++ 1 file changed, 11 insertions(+) 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(); + } }