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.

Customising the CMS /

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

Adding custom button to Tiny_MCE


Go to End


3 Posts   1854 Views

Avatar
AndrewMK

Community Member, 23 Posts

19 January 2009 at 12:04pm

I have been reading some previous forum threads about the customising of TinyMCE and basically i have built a custom button for tiny MCE but cannot get it running what so ever.

What i have done so far is :
Created a new class /mysite/code/alternatetoolbar.php this contains a customised buttons function that returns all the buttons AND my custom button.
Edited /cms/code/leftandmain.php changed EditorToolbar function from 'return new HtmlEditorField_Toolbar($this, "EditorToolbar");' TO 'return Object::create('HtmlEditorField_Toolbar', $this, 'EditorToolbar');'
Added 'Object::useCustomClass('HtmlEditorField_Toolbar', 'AlternateToolbar');' to /mysite/_config.php
Added my plugin to the /jsparty/tiny_mce2/plugins directory
Added button image to /jsparty/tiny_mce2/themes/advanced/images

But absolutely nothing appears in the application!!!!

I tried editing the 'HtmlEditorField_Toolbar' and adding the button and whilst this added the button, the button did nothing when pressed!

If anyone can help please let me know.

Avatar
Sigurd

Forum Moderator, 628 Posts

10 February 2009 at 5:32pm

Which version of SilverStripe are you using? This becomes easier in 2.3 ... :)

Avatar
AndrewMK

Community Member, 23 Posts

11 February 2009 at 8:44am

Using 2.23 I got it working in the end but i had to edit the 'HtmlEditorField_Toolbar' instead of using my own function.