Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Media handling in Drupal 8.6.0: new amazing options

Parent Feed: 

Various media, like videos, audios, or images, make your website really engaging. They fill it with colors, music, vivid impressions, and exciting experiences. And Drupal 8 offers new great options for media handling, which make it a leading CMS in 2018. The latest version, Drupal 8.6.0, brings especially interesting media features. We will start exploring the new media opportunities in Drupal 8 right now.

New Drupal 8.6.0 media handling features

Thanks to the Drupal Media Initiative, Drupal 8 now has new modules in core — the Media and the Media Library, which have inherited the best capabilities from a number of contributed modules. They introduce new and awesome concepts like media types, media fields, reusable media, and more.

So what can you do with them? First of all, you can:

  • add media of various types to your site
  • save and reuse media in your Media Library
  • place media inside your content
  • embed remote YouTube and Vimeo videos via an URL

and much more. Let’s consider these options in more detail.

Adding media of various media types to your site

To add media to your website, you can use the ready media types provided by Drupal. In Drupal 8.5.x, there were four media types — Image, File, Video, and Audio.

But Drupal 8.6.0 has prepared a new one — Remote Video, which lets you add third-party videos from YouTube and Vimeo. We will discuss it in more detail later in this post.

remote video media type

In addition to the default media types, you can create custom ones, and specify their media source.

Thanks to the media types, adding media is as easy as adding content, and can be done in Content — Add Media.

add media

Saving and reusing media in the Media Library

As of Drupal 8.6.0, all media can be conveniently stored in your Media Library for further reuse. You can easily access, publish, unpublish, save or delete all the media items in Content — Media.

For your convenience, media can be filtered by media type, publishing status, and name, as well as sorted by newest or oldest and descending or ascending alphabetical order.

One of the greatest things is that you can fetch media from the Media Library while creating your content — for example, to place video inside your blog post. We are moving on to this topic right now.

media library

Placing media inside your content via media fields

Media can be embedded into your content in the most natural way for Drupal — via fields. There is now a special new field type called Media that you can add to your content type (article, blog post, news etc.). When adding this field, you need to specify whether it will be Audio, Video, Remote Video, File, or Image.

the media field

the media field type

After that, on the content creation form, you will see the media embed option. The “Browse” button brings your Media Library to choose your media from.

adding media to content

Embedding remote YouTube and Vimeo videos with oEmbed

Here is one of the most exciting new options for media management in Drupal 8.6.0. It lets you embed remote videos from YouTube or Vimeo with just a URL.

Just add the Media field to your content type, specify it as “Remote Video,” arrange the fields to your liking — and remote videos will be ready to jump inside your content! Just as we described in the previous example, the videos can be fetched from the Media Library during content creation.

add remote video

add remote video to article

remote video embedded into article

Final thoughts

This is just a glimpse at media handling opportunities in Drupal 8 — particularly, Drupal 8.6.0. There are more additional settings for formatting your media, creating custom fields to pull more special data from the source, and many more.

The sky is the limit on your options, and the Media features are hot off the press and constantly developing.

To enjoy all these new features, you need to update your website to the innovative Drupal 8.6.0. For this, as well as for creating the perfect media setup, feel free to contact our Drupal support firm!

Author: 
Original Post: