elofgren:Display a useful error message if getCMSFields() returns null. Thanks Sam: http://www.silverstripe.com/general-discussion/flat/1537?showPost=2042#post2042

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41942 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-15 21:09:13 +00:00
parent 2c07f001f2
commit 7463a8fb05

View File

@ -279,6 +279,9 @@ JS;
if($record->DeletedFromStage) $record->Status = _t('CMSMain.REMOVEDFD',"Removed from the draft site");
$fields = $record->getCMSFields($this);
if ($fields == null) {
user_error("getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR);
}
$fields->push($idField = new HiddenField("ID"));
$fields->push($liveURLField = new HiddenField("LiveURLSegment"));
$fields->push($stageURLField = new HiddenField("StageURLSegment"));