Text editors

How to add TinyMCE Plugins to v2.4

Picture of Heidi Gartenberg
How to add TinyMCE Plugins to v2.4


I've been searching the forums to understand if I can add TinyMCE plugins ("Template" and "Insert Embedded Media") to my Moodle installation (without modifying core code).  Seems like Template might be on the roadmap https://tracker.moodle.org/browse/MDL-36505 but not clear.  

In any case I need an immediate solution for making a template to use for creating content using Book Module resource.  Template should have  a table with a background image and several columns with default text parameters.

If anyone has another way to do this I'd be very grateful if you shared.

I also need the ability to upload .swf files setting wmode to transparent which seems inherent in the native TinyMCE plugin "Insert Embedded Media" however does not appear with the "Insert Moodle Media" button.  All my attempts to follow instructions for editing the html code manually using the object tag have failed (I think because I still don't understand how to correctly reference the file URL in v2).  Cleary, I'm not a programmer smile.

I am using Bitnami Ubuntu cloud-hosted version 2.4 stack.




Average of ratings: -
It's only an avatar...
Re: How to add TinyMCE Plugins to v2.4
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

The Moodle Tracker issue you linked to is for the Moodle doc http://docs.moodle.org/24/en/Text_editor which explains how to use the TinyMCE editor.

I'm not sure about the template though, but I do know that the OBJECT tag works as I have managed to add SWF files to Moodle on numerous occasions. So perhaps it is that you are doing this all wrong. Also, and this is important, the WMODE should be set to OPAQUE if you want it to work in Internet Explorer, it fixes a bug in that browser. This is the code  I use, which is W3C validated.

<object width="350" height="195" data="http://full-URL-to-SWF-file" type="application/x-shockwave-flash">
<param value="full-URL-to-SWF-file" name="movie">
<param value="opaque" name="wmode">

Change height and width to whatever values you need.

Before you do any of this, there is a setting which you also need to enable to "Allow EMBED and OBJECT tags". You will find this in...

Settings > Site Administration > Security > Site policies

I hope this helps?



Average of ratings: -
Picture of Heidi Gartenberg
Re: How to add TinyMCE Plugins to v2.4

Hi Mary,

First of all thanks so much for taking the time to reply.

I should be more specific.

  1. I am creating a table (in a book chapter), adding a background image to the table then inserting the swf in one of the columns in the table.
  2. I have no problem uploading/embedding swf file into the resource but since the background image is dark and the swf was not created with a transparent background I see a white box around the images displayed in the swf
  3. I have no ability to re-generate the swf with transparent background but understand I can do it when embedding by setting the wmode param to transparent using an object tag (like you show in your post) - (I was unaware of a problem with IE so this now concerns me)
  4. I found that while the inherent "Insert Moodle Media" does not give specific access to these options when uploading a flash file - the standard TinyMCE button "Insert Embedded media" does; (see attachment)
  5. I was hoping there was a way to add this to my Moodle since even if I am successful in modifying the html manually - what I really need is a single template that I can use for every chapter of many books that I am going to create.
  6. I am creating all content at the point as admin so it shouldn't matter - however I had previously changed the Site Policy to Allow Object and Embed to allow other users to do this.
  7. I'm having a hard time following the discussions about how files are stored in the database in v2 (I'm recently returning to working with Moodle after almost 2 year breakand experience with 1.9) with regard to how to reference them when editing. I tried to first embedd the swf with "Insert Moodle Media" in order to get the URL from the html that is generated this way and then replace the href with an object tag but it seems the URL is for the draft version while editing and I don't know how to get the correct URL and the file is not found this way - or least nothing displays on the background and I do not know how/where to check for possible errors. 

Hope that is clearer.


Average of ratings: -
It's only an avatar...
Re: How to add TinyMCE Plugins to v2.4
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

Oh...sorry I just thought it was a simple thing, after reading your reply I see it's quite a problem you have.

I've no idea about TinyMCE templates, although they sound like predefined settings that you can use over and over again, much like a macro, but then again I dare say that may be too advanced for TinyMCE. smile

Let's hope someone answers soon who knows more about these things.

The OPAQUE wmode thing with IE, is so that the SWF does not sit above all the other elements on the page. Adding TRANSPARENT does that apparently and so if you have a SWF file in the frontpage of your Moodle site, just below the custommenu, the dropdown items fall behind the embeded SWF. Using OPAQUE fixes that problem. It's not really a bug, it's just the way Internet Explorer renders flash objects.

Sorry I can't help.



Average of ratings: -
Picture of AL Rachels
Re: How to add TinyMCE Plugins to v2.4
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Heidi,

Creating the template is very easy...at least this works in book for me.

  1. Start your book, make a page with the your table and background picture in it.
  2. I find this works best if I go ahead and specify the width and hieight I want the table to be to accomodate the size of the background picture.
  3. Save the page.
  4. Open the page back up for editing, select all (Ctrl+a), then copy (Ctrl+c) then save the page again.
  5. Create your new page, type in the chapter title.
  6. Click into the content area and paste (Ctrl+v).  You now have a copy of your table with the background picture.
  7. Save the page
  8. Repeat step 5, 6 and 7 to make as many pages as you need.

I find that you can also go into another book and paste your template onto a page there. If you have multiple designs or table setups, make a book of just the templates, then copy and paste as needed. When I do this I normally have two browser windows open and copy and paste from one book to the other. (easy with dual monitors)

NOTE: This works with the table and static content. When I try to copy and paste with a video already embedded in the table, the video breaks and has to be re-inserted.

Hope this is clear and helps,


Average of ratings: -
Picture of Heidi Gartenberg
Re: How to add TinyMCE Plugins to v2.4

HI Al,

Thanks for responding.  What you describe is more or less what I am doing now (although making a book with various templates to copy/paste from is a nice idea I hadn't thought of) and in this case it is a good solution requiring not much more effort than being able to pull in a template through the editor.

The reason I asked the original question more generally is because there seems to be other options and features in the generic TinyMCE app that were not implemented in Moodle that I would like to have.

Specifically I want to be able to embed swf files with a transparent background (without editing the html of each book chapter).  If you have any ideas for this one  - please let me know!

Thanks Again,


Average of ratings: -