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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

tinymce config


Go to End


5 Posts   6510 Views

Avatar
Billy_

Community Member, 17 Posts

8 April 2008 at 3:09pm

Edited: 08/04/2008 3:27pm

Which file(s) do I need to edit to change tinymce controls? I've configured tinymce controls in another cms, but simlar edits in SS don't seem to work (version 2.2.2-rc2).

Thanks :)

-Billy

Avatar
sarahk

Community Member, 46 Posts

4 June 2008 at 4:45pm

Edited: 04/06/2008 4:45pm

hmmm, just what I need to know too :)

Avatar
Grayzag (aka ajshort)

29 Posts

4 June 2008 at 6:48pm

The code for all the TinyMCE buttons is located in /sapphire/forms/HtmlEditorField.php, in the HtmlEditorField_Toolbar class. Check out the buttons function. In order to edit the HTML Editor, but so your changes don't get lost on an update, copy the HtmlEditorField_Toolbar class to another file in your mysite/code directory e.g. AlternateToolbar.php. Also, rename the class name to AlternateToolbar. Once this is done, you can tell SilverStripe to use your custom class to use this instead of the default toolbar by placing

Object::useCustomClass('HtmlEditorField_Toolbar', 'AlternateToolbar');

Then any changes you make to the AlternateToolbar class will hopefully appear in the CMS. To edit/add/remove buttons, just edit the Buttons() function. The alternative is to wait until the next release, as I think the toolbar is being updated to be easily configurable.

Avatar
KingBerT

Community Member, 11 Posts

5 June 2008 at 7:09am

I've followed your instructions, but I don't get it work!

Where do I have to put this line?!

"Object::useCustomClass('HtmlEditorField_Toolbar', 'AlternateToolbar');

I've put it into

mysitenamefolder/_config.php

Avatar
Grayzag (aka ajshort)

29 Posts

5 June 2008 at 10:04am

Edited: 05/06/2008 10:24am

Sorry, i'm afraid i made a mistake with my instructions. Currently the CMS interface doesnt use the factory method to create the toolbar, so the class will not get overridden. However, if you open up cms/code/LeftAndMain.php, and locate the EditorToolbar function, and replace it with

return Object::create('HtmlEditorField_Toolbar', $this, 'EditorToolbar');

then your custom class will get used properly. For your custom class, id suggest creating a class that extends HtmlEditorField_Toolbar in your mysite/code directory, and then putting the useCustomClass call in mysite/_config.php - and then override the Buttons function in your custom class.