Limit HtmlEditorField HTMLText casting note to existing fields

This prevents it from failing for proxied values
like BlogEntryForm, where the field name doesn't exist,
and rather gets processed and saved into a different field.
This commit is contained in:
Ingo Schommer 2013-04-29 09:32:05 +02:00
parent 8f6451612b
commit 5ca9db5e5e

View File

@ -95,7 +95,7 @@ class HtmlEditorField extends TextareaField {
}
public function saveInto(DataObjectInterface $record) {
if($record->escapeTypeForField($this->name) != 'xml') {
if($record->hasField($this->name) && $record->escapeTypeForField($this->name) != 'xml') {
throw new Exception (
'HtmlEditorField->saveInto(): This field should save into a HTMLText or HTMLVarchar field.'
);