From 09e787a6de4a039a621aeb3853984ac1ba416ad1 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 13 Oct 2008 02:26:02 +0000 Subject: [PATCH] Added ->itemWriteMethod parameter, to adjust the way that CTFs write (for instance, to save and publish instead of just save) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2@64128 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/ComplexTableField.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index 66beeecbb..fb7fc8b85 100755 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -117,6 +117,12 @@ class ComplexTableField extends TableListField { */ protected $relationAutoSetting = true; + /** + * Set the method for saving changes to items in the detail pop-up. + * By default, this is write, which just saves the changes to the database. + */ + public $itemWriteMethod = "write"; + /** * See class comments * @@ -766,7 +772,10 @@ class ComplexTableField_Popup extends Form { } $this->saveInto($childObject); - $childObject->write(); + + $funcName = $this->controller->itemWriteMethod; + if(!$funcName) $funcName = "write"; + $childObject->$funcName(); // if ajax-call in an iframe, update window if(Director::is_ajax()) {