Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

I don't want WYSIWYG

Go to End

6 Posts   4434 Views


Community Member, 2 Posts

13 June 2007 at 6:12am

I would like to write my articles in source code mode instead of WYSIWYG. But how to do that? Maybe you answer me "use HTML button in editor", but when I do that, my code is changed after loading to WYSIWYG - for example all national symbols (like "ô","ä","č","ľ" etc.) are changed to entities ("aa;culate;" etc.), and some tags then don't work properly...

Can you help me! Many thanks


Administrator, 690 Posts

13 June 2007 at 11:13am

In your page class, you will need to remove the HTMLEditorField and add a TextAreaField.

class Page {
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root.Content.Main', 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextareaField('Content'));

See for more information on what you can do with the TextareaField.

You should be aware that this will insert whatever you type into the TextareaField straight into your template, without validation. It's fine if you know what you're doing, but if you're handing this over to a non-technical author you'll want to make sure they use the draft site tool! :-)


Google Summer of Code Hacker, 222 Posts

7 July 2007 at 5:24pm

Hi Sam,

Thanks for this! Disabling the WYSIWYG can be quite nice. :)

As per development-guidelines:removefieldfromtab, this line is needed at the end of the getCMSFields() function:

return $fields;

Otherwise you will get this error:
Fatal error: Call to a member function push() on a non-object in /sites/ on line 268

Took me a few minutes to figure out why. ;)

New bbcode is nice! :)

Good night,



Administrator, 690 Posts

8 July 2007 at 9:41pm

Elijah: Usability applies to programmers, too!

Do you perhaps want to add a check to CMSMain, where it calls getCMSFields(). If $fields returns null, have an error along the lines of

"getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?"


Google Summer of Code Hacker, 222 Posts

9 July 2007 at 1:22pm

Thanks Sam! :)

r38115 | elofgren | 2007-07-08 20:21:20 -0500 (Sun, 08 Jul 2007) | 1 line

Display a useful error message if getCMSFields() returns null. Thanks Sam:


2 Posts

24 September 2007 at 5:24am


i can't seem to get my wysiwyg disabled, i know this is tedious but can anyone please post what files they edited and the exact code they wrote. thanks very much. i hope somebody would be kind enough.