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
This commit is contained in:
Sam Minnee 2008-10-13 02:26:02 +00:00
parent 5ca5dd15ee
commit 09e787a6de

View File

@ -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()) {