Casting an array in return

Hi there,

I’m new with SS4.2 and I’m starting with the Contact form tutorial on Simple Contact Form – SilverStripe Documentation

It’s working fine, excepted a detail with

return [
            'Content' => '<p>Thank you for your feedback.</p>',
            'Form' => ''
        ];

I do see the html codes <p>...</p>.

I guess it’s normal according to the Casting documentation on Formatting, Modifying and Casting Variables – SilverStripe Documentation

But I’m not able to solve it. I set

private static $casting = [ 'submit' => 'HTMLText' ];
but its’ not working.

Any idea ?

If your “thank you” content is hard-coded, I’d probably just return it as a DBField instance rather than a string:

'Content' => DBField::create_field('HTMLFragment', '<p>Thank you for your feedback.</p>')