MINOR ModelAdmin documentation

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@73337 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-03-18 14:13:03 +00:00
parent be985afd24
commit caa961e4fb

View File

@ -685,7 +685,24 @@ class ModelAdmin_CollectionController extends Controller {
}
/**
* Returns a form suitable for adding a new model, falling back on the default edit form
* Returns a form suitable for adding a new model, falling back on the default edit form.
*
* Caution: The add-form shows a DataObject's {@link DataObject->getCMSFields()} method on a record
* that doesn't exist in the database yet, hence has no ID. This means the {@link DataObject->getCMSFields()}
* implementation has to ensure that no fields are added which would rely on a
* record ID being present, e.g. {@link HasManyComplexTableField}.
*
* Example:
* <code>
* function getCMSFields() {
* $fields = parent::getCMSFields();
* if($this->exists()) {
* $ctf = new HasManyComplexTableField($this, 'MyRelations', 'MyRelation');
* $fields->addFieldToTab('Root.Main', $ctf);
* }
* return $fields;
* }
* </code>
*
* @return Form
*/