I have a data object with the code
<?php
class HeroBannerImage extends DataObject {
private static $db = array (
'Name' => 'varchar',
'Duration' => 'int',
'Message' => 'HTMLText'
);
private static $has_one = array (
'Banner' => 'HeroBanner',
'Img' => 'Image'
);
public function getCMSfields()
{
$fields = FieldList::create(
TextField::create( 'Name' ),
HTMLEditorField::create( 'Message' ),
DropdownField::create( 'Duration' )
->setSource( ArrayLib::valuekey( range( 5, 20 ) ) ),
$upload = UploadField::create( 'Img', 'Upload or select an image' )
);
$upload->getValidator()->setAllowedExtensions(array(
'png', 'jpeg', 'jpg', 'gif'
));
$upload->setFolderName('hero-images');
return $fields;
}
}
When I click save in the CMS I get an ambigious error that makes me dig around in the framework code. When I find the line the error refers to I find
/framework/forms/HtmlEditorField.php
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.'
);
}
Could someone point me in the direction as to what this error means. The Message field *is* a HTMLText field.
Thanks