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.


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

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

I don't want WYSIWYG


6 Posts   3889 Views


13 June 2007 at 6:12am Community Member, 2 Posts

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


13 June 2007 at 11:13am Administrator, 685 Posts

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! :-)


7 July 2007 at 5:24pm Google Summer of Code Hacker, 222 Posts

Hi Sam,

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

As per [url=]development-guidelines:removefieldfromtab[/url], 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,



8 July 2007 at 9:41pm Administrator, 685 Posts

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?"


9 July 2007 at 1:22pm Google Summer of Code Hacker, 222 Posts

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:


24 September 2007 at 5:24am 2 Posts


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.