Drupal 7: WYSIWYG YouTube Embed Tutorial (Media_YouTube)

2 Kudos

Why would you need a YouTube plugin for Drupal? Can’t you just use the embed code?
Yes, yes you can. However, you may run into a client where copying and pasting the embed code becomes too technical.  So lets forget about why we need this and I’ll explain how to get it set up.

After switching over to Drupal 7, I decided to use the WYSIWYG module to implement text editors instead of custom built modules for text editors.  This now allows us to keep up to date with the latest release of editors like CKEditor, TinyMCE, etc.  Since you just drop them into the libraries folder and they will work.
However, after changing this process I found that normal plugins for the editors are handled differently.  They aren’t implemented into the editor and then just added with a simple JavaScript addition, but require a custom Drupal module to enable them in the UI of WYSIWYG.  So you if have an custom plugins for your editor then you will either need to write/find a custom Drupal module to enable them or find and alternative.  If you are looking for more information on this, look in the WYSIWYG module folder and open the files wysiwyg.api.php and wysiwyg.api.js for the nessesary hooks and documentation.

What you need:
Drupal 7.x
Media 7.x
Media Youtube 7.x
Views 7.x
CTools 7.x
File Entity 7.x
Your favorite editor (TinyMCE, CKEditor etc.)

I am going to start by assuming you have your site, and editor installed and working properly.
Next download and enable the media and media_youtube modules.

Go to:
for Full HTML – admin/config/content/wysiwyg/profile/full_html/edit
for Filtered HTML – admin/config/content/wysiwyg/profile/filtered_html/edit

Then under “Buttons and Plugins” enable “Media” and also “Media browser

Save it.

Two things left.  Enabling the markup, and setting the permissions.

To enable the markup on Full HTML go to – admin/config/content/formats/full_html
To enable the markup on Filtered HTML go to – admin/config/content/formats/filtered_html

Check on the box – “Converts Media tags to Markup

Then all that is left is to make sure every role has the correct permissions, look under the “Media” category.

Comment below if you have any problems.

Also read...