Hello,
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();
HtmlEditorConfig::set_active("cms");
$fields->push(HtmlEditorField::create("Titre", "Titre français")
->setRows(10));
HtmlEditorConfig::set_active("reduced");
$fields->push(HtmlEditorField::create("Info", "Plus d'info")
->setRows(10));
return $fields;
}
}
And my _config.php :
<?php
/*... some code ... */
$reduced = HtmlEditorConfig::get('reduced');
$reduced->disablePlugins('table');
$reduced->setButtonsForLine(1,
'bold','italic','underline','strikethrough','separator',
'formatselect','separator',
'bullist','numlist','hr','charmap'
);
$reduced->setButtonsForLine(2);
$reduced->setButtonsForLine(3);
$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.
H.