DISCLAIMER: This doesn't work as you would expect it in SilverStripe 3.*. The reason is that the configuration is chucked as an inline javascript into the bottom of the DOM of the CMS. The individual settings aren't reloaded unless doing a full page reload. (2014-02-28)
Here's an example of how you can configure the TinyMCE that comes with SilverStripe.
Put the below configuration somewhere in a _config.php
.
HtmlEditorConfig::get("basic")->setOptions(array(
"friendly_name" => "basic editor",
"priority" => 0,
"mode" => "none",
"editor_selector" => "htmleditor",
"auto_resize" => true,
"theme" => "advanced",
"skin" => "default",
// Remove the bottom status bar
"theme_advanced_statusbar_location" => "none"
));
// Clear the default buttons
HtmlEditorConfig::get("basic")->setButtonsForLine(1, array());
HtmlEditorConfig::get("basic")->setButtonsForLine(2, array());
HtmlEditorConfig::get("basic")->setButtonsForLine(3, array());
// Add the buttons you would like to add, see
// http://www.tinymce.com/wiki.php/buttons/controls for a comprehensive list
HtmlEditorConfig::get("basic")->setButtonsForLine(1, "bold", "italic");
The following should then be added in a DataObject::getCMSFields()
method.
HtmlEditorConfig::set_active('basic');
$fields = new FieldList(
new HtmlEditorField('Content', 'Content')
);
For a full list of TinyMCE configuration options, see TinyMCE configuration.
A dropdown of configured tinymce editors will also show up under a group in the
security admin (Admin > Security > Groups > Permissions
). This gives an
administrator the option to restrict and simplify the editing in a
HTMLEditorField
for a group of users.