SilverStripe TinyMCE Media / Embed Movies How-to

2

Posted on : 03-12-2008 | By : Stefan | In : Silverstripe CMS

Phew! I’ve just spent the best part of 3 hours figuring out how to add in media support for TinyMCE and SilverStripe CMS. I hope the following code helps others and if there’s any questions i’ll do my best to help.

Firstly we need to add the button to the TinyMCE. SilverStripe is setup to do this by linking in from a seperate file.

Edit /saphire/forms/HtmlEditorField.php
new HtmlEditorField_button(”mceMedia”,”media:media”,_t(’HtmlEditorField.MEDIA’, “Insert media”)),

Next we need to enable the backend TinyMCE code itself.

Edit /cms/javascript/tinymce.template.js
mode : “textareas”,
plugins : “contextmenu,table,emotions,media,paste”,

Now go to /admin/?flush=1 to flush the cache.

That’s it, you should have a media button on your TinyMCE toolbar which pops up and gives option to add in Flash, Quicktime, WMV etc.

Comments

test

Hi Stefan. I’ve been trying to add a forecolor button to the TinyMCE toolbar in SilverStripe 2.2.3 with little success. I’ve added:

new HtmlEditorField_button(”forecolorpicker”,”forecolor”,_t(’HtmlEditorField.FORECOLORPICKER’, “Change text color”)),

to the buttons function of HtmlEditorField.php and:

forecolor,forecolorpicker

to the theme_advanced_buttons1 : in tinymce.template.js

The button appears in the toolbar, and the colorpicker popup works, but doesn’t actually ‘apply’ the colours.

wonder if you could help?

Post a comment