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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

HTMLEditorConfig - per Editor configuration - question from a humble n00b.

Go to End

10 Posts   3256 Views


Community Member, 4 Posts

12 January 2011 at 12:15pm

Hi there,

Just a quick question, any help would be greatly appreciated.

Is it possible to customize the TinyMCE editor on a per 'TinyMCE Editor Field' basis?

ie: I want 3 TinyMCE fields on a page, each one containing only certain buttons and allowed HTML tags etc.

Thanks in advance.
kind regards


Forum Moderator, 5513 Posts

12 January 2011 at 8:20pm

You can set the htmleditorconfig values in the getCMSField. You can also have multiple htmleditor configs defined and swap between them when making your getCMSFields.

$fields->addFieldToTab('Root.Main', new HtmlEditorField('Field'));


Community Member, 12 Posts

12 July 2011 at 7:06am

Hi all,

Building off of this concept:

Would anything change with setting the config for a front end form?

I have created a new fieldset:

$fields = new FieldSet(
         new TextField('Title', 'Product Name'),
         new CurrencyField('Price', 'Price'),
         new NumericField('TotalAvailable','Total Available'),
         new ImageUploadField('MainImage', 'Main Image'),
         new HTMLEditorField('Content', 'Product Description')

Would I still use something like HtmlEditorConfig::set_active('cms-small') after declaring the new fieldset?




Community Member, 67 Posts

15 September 2011 at 2:54am

Edited: 15/09/2011 2:55am

Hello Willr,

I can't make your code works :(

i tried this in my decorator object :

   public function updateCMSFields(FieldSet $fields) {
      // backup current HtmlEditorConfig identifier (is it usefull ?)
      $oldActiveConfig = HtmlEditorConfig::$current;

      $basicConfig = HtmlEditorConfig::get('basic');
      $basicConfig->setButtonsForLine(1, array('bold','italic','underline'));
      $basicConfig->setButtonsForLine(2, array());
      $basicConfig->setButtonsForLine(3, array());
      $basicConfig->setOptions( array(
         'friendly_name' =>'Basic HTML Editor'

      $HtmlEditorField = new HtmlEditorField("Presentation", _t('Presentation.SINGULARNAME', 'Presentation') );
      // restore old current HtmlEditorConfig identifier (is it usefull ?)

      $fields->addFieldToTab("Root.Main", $HtmlEditorField);

but all HtmlEditorFields in all Pages (in admin interface) are now 'basic'...


Community Member, 67 Posts

16 September 2011 at 8:23pm

I found the [url=]CustomConfigHtmlEditorField developped by Will in silverstripe-recipes on gitHub[/url]

It works great :D

Thanks Will !


Community Member, 3 Posts

21 March 2012 at 6:04am

Thanks for the CustomConfigHtmlEditorField tip - that one is really a live-safer :)


Community Member, 5 Posts

13 August 2012 at 12:22am

Has anybody successfully done different editor configurations in one form with 3.0? Somehow it's always the last active configuration that gets used for all HtmlEditorFields on the page... I aim to have two fields allowing only bold and italic formatting plus one full-fledged editor field in my form. Whatever i do though, i end up with having one config or the other on all three fields. Is there some way to apply a configuration per editor instance?

Any help greatly appreciated,


Community Member, 12 Posts

13 August 2012 at 2:37am

Here's a video tut by uncle cheese utilizing bootstrap forms with SS3. I think he goes through configuring the HTMLEditorFields:

Go to Top