Webdrips Drupal 8 Demo: Use the Built-in Media/Media Library Drupal Modules to Manage Media Assets with Ease
2019-02-14

Introducing the Core Drupal 8 Media and Media Library Modules

Starting with Drupal 8.6, we finally have a media management system we can be proud of that's part of Drupal core. Now both adding media to pages and managing media assets are easily done with a beautiful new User Interface (UI). The Drupal community can now say with a straight face Drupal’s media capabilities are on par with CMS platforms like WordPress.

When combined with the Workflows module (also now part of Drupal core), it’s easier than ever to upload, manage, and reuse media assets, then move content between workflow states (e.g. “draft”, “review”, and “published”) for simple to complex content (and media) moderation.

Add and embed built-in media types including, audio, video, files, and offsite assets from YouTube or Vimeo videos directly in your content text areas. If that's not enough, you can define your own media types out of box without adding any additional modules.

Wait it gets better: because all media types are entities, you can add fields to any/all media types. For example, you can add tags to media to further help categorize all your assets. 

Test-drive this Feature on this Demo Site

The Drupal Media Module Provides a Built-in Media Listing Page

You will find this concept very often with core Drupal 8 modules: the UI looks and behaves similarly across similar screens. This promotes a much faster learning curve while increasing productivity.  

What is a Module? Drupal Modules provide plug-and-play features and functionality. Typically you can enable and configure them to make their feature and/or function available. Drupal has core modules that "ship" with Drupal, and nearly 7,000 contributed modules available for Drupal 8. Contributed modules are modules added and maintained by the Drupal community.

Webdrips Drupal 8 Demo Media Listing Page
Drupal 8 Demo Media Listing Page

 

You can do the following with the Media Listing Page:

  1. Filter on name, type (audio, file, video, etc.) published status, and language for multilingual-capable sites.
  2. Apply actions to multiple media assets at once, such as publish/unpublish and delete.
  3. Use the table or grid view to edit individual media assets

Adding and Editing Multiple Media Assets Using the Media Module

Adding and editing multiple media assets (to be referenced later anywhere on the site) is incredibly simple. If you only plan to add one media asset at a time, you can skip to the next section.

Webdrips Drupal 8 Demo Media Module Edit Image Form
Drupal 8 Demo Media Module Edit Image Form

 

At a minimum, you'll add the a descriptive name in the Name field and then use an upload widget to navigate your computer and select the desired file. If you're adding an image, you can also add alt text for screen readers and search engine metadata. 

That's it! We'll see how to add this newly uploaded asset to a page next.

Adding Existing or New Media Assets to a Page (or Other Entity) using the Media Library Module

Once we have a media field added to a given entity (e.g. a page or block), we are presented with a widget to add/edit media.

Webdrips Drupal 8 Demo Media Library Widget on the Page Edit Form
Drupal 8 Demo Media Library Widget 

 

If you already uploaded your media, click Browse media, and you're greeted with a popup dialog.

Webdrips Drupal 8 Demo Media Library Module Select Media Dialog
Drupal 8 Demo Media Library Module Select Media Dialog

 

You can use the filters to narrow down your selections, then use the checkbox in the upper-right to select the desired media to add. 

If you haven't uploaded the image you wish to add to a page, you can do so on-the-fly using the Add media button. The procedure is nearly identical to how it's done when adding media in bulk, which we covered in the above section.

Use the Drupal Media and Media Libraries in conjunction with the Layout Builder module to easily dictate where media can be placed on a page.  

Conclusion

The new Media and Media Library modules built into Drupal core provide a user experience leaps and bounds better than previous versions of Drupal. You can easily add, edit, and manage any type of media asset that's built in, or define your own type. Add additional fields when needed to help categorize your media better. 

Test-drive this Feature on this Demo Site

Image
Webdrips Drupal 8 Demo: Use the Built-in Media/Media Library Drupal Modules to Manage Media Assets with Ease