January 27, 2009

Media Button in WYSIWYG Module

Filed under: Drupal, PHP — admin @ 11:17 am

We’re implementing the new WYSIWYG Module in Drupal 6, and really digging it.  We are using it with our WYSIWYG Editor of choice: TinyMCE (3.2.1.1).

We noticed, however, as we were setting up the module in Drupal, that our beloved media button was gone. Here’s how we got it back in there:

First, you need to install and setup the module & tinyMCE as detailed in the readme file.  Next, open ‘…modules\wysiwyg\editors\tinymce.inc’

All you have to do is add a few lines of code (around line 472):

‘layer’ => array(
‘path’ => $editor['library path'] .’/plugins/layer’,
‘buttons’ => array(’insertlayer’ => t(’Insert layer’), ‘moveforward’ => t(’Move forward’), ‘movebackward’ => t(’Move backward’), ‘absolute’ => t(’Absolute’)),
‘url’ => ‘http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/layer’,
‘internal’ => TRUE,
‘load’ => TRUE,
),

/*Begin Inserted Lines*/

‘media’ => array(
‘path’ => $editor['library path'] .’/plugins/meda’,
‘buttons’ => array(’media’ => t(’Insert Media’)),
‘url’ => ‘http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media’,
‘internal’ => TRUE,
‘load’ => TRUE,
),

/*End Inserted Lines*/

‘paste’ => array(
‘path’ => $editor['library path'] .’/plugins/paste’,
‘buttons’ => array(’pastetext’ => t(’Paste text’), ‘pasteword’ => t(’Paste from Word’), ’selectall’ => t(’Select all’)),
‘url’ => ‘http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste’,
‘internal’ => TRUE,
‘load’ => TRUE,
),

Now the media button will be available to be selected as an option from your TinyMCE administrator page within drupal.

2 Comments »

  1. Thank you for these instructions for the media button but…

    I followed the instructions for adding the media button, but after adding the lines to tinymce.inc, as instructed (and correcting the typo and changing:
    ‘path’ => $editor['library path'] .’/plugins/meda’,
    to
    ‘path’ => $editor['library path'] .’/plugins/media’,
    then when I reload the /wysiwyg/profile page, I just get a blank page. A soon as I delete these lines from the INC file, the profile page comes back.
    I cleared the cache and reloaded many times, still with the same results in both Firefox and MSIE.
    What is going on??

    Comment by Norm Strassner — February 12, 2009 @ 1:34 pm

  2. woohoo! awesome! it works! now tinymce can handle media inline and i don’t have to create a custom CCK field. a much more streamlined and user friendly approach. thank you so much for posting!

    Comment by drew — August 28, 2009 @ 3:36 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Who we are

Explore our history and character.

If you've ever been on a blind-date, odds are great that you know how disastrous "jumping before looking" can be. Feel free to do some online stalking here before you contact Soleer.

What We Do

"Girls only want boyfriends who have great skills." -Napoleon Dynamite

While we aren't looking to be your boyfriend and might not have "nunchuku skills," we do offer a number of other services and solutions to assist your organization.

What We’ve Done

As we say in Texas, "This ain't our first rodeo." Take a look at a sampling of some of our masterpieces, from logo design and brochure creation to webpage design and online community development.