0

im beginner at silverstripe and I dont know how to fix that issue. Couldn't find anything in the docs as well.

I have added HTMLText Field (that tinymce editor) and everything seems to work OK. Data is saved and served on the web but the data is not rich. It renders html tags as well. How to change that?

Thanks.

1 Answers1

0

It would be helpful if you posted some code snippets of the approach you have taken so we can see where you might have gone wrong. So, I'm going to take a guess here: did you make the data-field an HTMLText field? For example: if I want to use $TextBlock in my template as HTML, then I would need to save it as HTMLText and use HTMLEditorField in the CMS. If I would save it as Text or Varchar I would get unexpected results. See: https://docs.silverstripe.org/en/4/developer_guides/forms/field_types/htmleditorfield/#rich-text-editing-wysiwyg

use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\ORM\DataObject;

class MyObject extends DataObject 
{
    
    private static $db = [
        'TextBlock' => 'HTMLText'
    ];
    
    public function getCMSFields() 
    {
        return new FieldList(
            HTMLEditorField::create('TextBlock')
        );
    }
}