Undoing change committed in r 70734

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@70738 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Normann Lou 2009-01-26 21:09:26 +00:00 committed by Sam Minnee
parent 20e829a6be
commit efbdaf7b2e

View File

@ -670,10 +670,13 @@ class ModelAdmin_CollectionController extends Controller {
} }
/** /**
* Returns a form for editing the attached model * Returns a form suitable for adding a new model, falling back on the default edit form
*
* @return Form
*/ */
public function AddForm() { public function AddForm() {
$newRecord = new $this->modelClass(); $newRecord = new $this->modelClass();
if($newRecord->canCreate()){ if($newRecord->canCreate()){
if($newRecord->hasMethod('getCMSAddFormFields')) { if($newRecord->hasMethod('getCMSAddFormFields')) {
$fields = $newRecord->getCMSAddFormFields(); $fields = $newRecord->getCMSAddFormFields();
@ -688,6 +691,7 @@ class ModelAdmin_CollectionController extends Controller {
); );
$form = new Form($this, "AddForm", $fields, $actions, $validator); $form = new Form($this, "AddForm", $fields, $actions, $validator);
$form->loadDataFrom($newRecord);
return $form; return $form;
} }