BUGFIX WidgetAreaEditor gets it's related WidgetArea using getComponent(), a more robust way of getting the component

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@77282 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-05-20 01:48:39 +00:00 committed by Sam Minnee
parent 30c95b1a65
commit 03aa331441

View File

@ -26,9 +26,7 @@ class WidgetAreaEditor extends FormField {
function UsedWidgets() {
$relationName = $this->name;
$widgets = $this->form->getRecord()->$relationName()->Widgets();
$widgets = $this->form->getRecord()->getComponent($relationName)->Widgets();
return $widgets;
}
@ -38,15 +36,14 @@ class WidgetAreaEditor extends FormField {
function Value() {
$relationName = $this->name;
return $this->form->getRecord()->$relationName()->ID;
return $this->form->getRecord()->getComponent($relationName)->ID;
}
function saveInto(DataObject $record) {
$name = $this->name;
$idName = $name . "ID";
$widgetarea = $record->$name();
$widgetarea = $record->getComponent($name);
$widgetarea->write();
$record->$idName = $widgetarea->ID;