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.

Customising the CMS /

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

SS 3.0.2 - Multiple HTMLEditorField with different config

Go to End

2 Posts   1629 Views


Community Member, 3 Posts

3 January 2013 at 5:42am

Edited: 03/01/2013 5:44am

I am trying to add two HTMLEditor with two different configs. It's seems like the HTMLEditor config is static and only the last active config is apply.

Here my code :

<?php // File : /mysite/NewsItem.php
class NewsItem extends DataObject{
      static $db = array("Titre"  => "HTMLText",
                         "Info"   => "HTMLText");
      static $has_one = array("News" => "News");
       public function getCMSFields(){
              $fields = new FieldList();
              $fields->push(HtmlEditorField::create("Titre", "Titre fran├žais")
              $fields->push(HtmlEditorField::create("Info", "Plus d'info")
              return $fields;

And my _config.php :

/*... some code ... */

$reduced = HtmlEditorConfig::get('reduced');
$reduced->setOptions(array("width"           => "80%",
                           "priority"        => 1));

$cms = HtmlEditorConfig::get('cms');
$cms->setOptions(array("width"           => "80%",
                       "priority"        => 1));

With this, both HTMLEditorField are in "reduced" mode...

I am using the 3.0.2 version. I've carfully read the docs of HtmlEditorConfig, and I cannot see my mistake.
Thanks for your help.


Community Member, 141 Posts

20 May 2013 at 11:03pm

Hi ChanteLame. Have you found a solution? I've got the same problem: two editors but both use the latest config.