Drupal 7 Youtube videos as fields in content type

I have been doing quite a lot of work with Drupal 7 the last couple of months. It has its ups and downs but one thing that it always tries to do is to prevent you from having to write your own code to solve problems.
It gets quite annoying then when simple things don’t work. In my case I wanted a content type with nothing but a title and a video field that shows Youtube videos that the editor pasted the URL to. That should work, right?

Well, yes, it should, but not without problems. First, I installed the Media module and then the Media:Youtube module. I set up a content type with a field of the type Multimedia Asset.

Then comes the kicker: without doing the following things didn’t work. The videos didn’t show up at all. It took me quite some time to figure this out.

At the Manage Display tab I had to first remove the video (make it Hidden) and then add it again so that I could choose a file view mode. See screenshot below.

The display types are defined in Config > File Types > Manage file display. Here I can choose Youtube video and after making sure the content type chooses a file view mode the video was displayed. *phew!*

Standard

12 thoughts on “Drupal 7 Youtube videos as fields in content type

  1. Kyle Copley says:

    thanks for the help! I had the same problem.

    Do you know if you can change the image-style or preview size? I need to change that then view the video in a colorbox

  2. Andrew says:

    As the “Multimedia Asset” now is deprecated, you can also use “File”, and else follow the above instructions. The key is the “File View Mode = Large”, which can also be set choosing e.g. “Rendered File” as “Format”. This works for me, and makes my site more future-safe.
    /Andrew

Leave a Reply

Your email address will not be published. Required fields are marked *