Each day, more Drupal 7 modules are being migrated to Drupal 8 and new ones are being created for the Drupal community’s latest major release. In this series, the Acquia Developer Center is profiling some of the most prominent, useful modules, projects, and tools available for Drupal 8. This week: Media Entity.
Janez Urevc, aka slashrsm, comes from the tiny and beautiful European country of Slovenia. He was one of the initial founders and leads of the Drupal 8 media initiative. At Zürich-based MD Systems--themselves heavy contributors to Drupal 8--Janez is a senior engineer and team lead. Before that, he worked at Examiner.com, one of the biggest Drupal websites and one of the top 10,000 websites in the world, according to Alexa.com.
What does the Media Entity Module do?
Media Entity--installed on roughly 1500 websites as of mid-2016--is new to Drupal 8. It provides a storage component for media, “a very lean and lightweight entity,” according to Janez, which can reference any media resources. Media Entity creates a relationship between a Drupal installation and a given media resource, for example local files, YouTube videos, Tweets, Instagram photos, and so on.
Thanks to its pluggable architecture, it also handles business logic related to specific media resources. Janez explains, “We are currently able to automatically provide default thumbnails and deliver remote metadata about media resources, as well as easily mapping remote metadata to Drupal fields. We will be adding more logic like that in the future.”
As of the writing of this post, there are plugin modules supporting the following media types:
Media Entity in action
This short screencast shows how to create a media entity that represents a Tweet using an embed code. It demonstrates how the module validates the embed code and how the remote metadata mapping API is used to fetch additional information from the remote source--the tweet’s content and retweet count in this case.
Why is this important?
Media Entity gives developers a set of standard code-tools to deal with with media. By developing media-type plugins, they can interact with their media resources and provide additional business logic for them. By exclusively using standard Drupal tools and APIs (Fields, Entities, Views, etc.), you can make your media-related code play nice with others. It lets you integrate with and benefit from other Drupal 8 systems and modules.
This module helps site owners in at least two ways. Important information--metadata--about individual media items that used to be hard to obtain can now be easily made part of rich media libraries. It also allows them to use whatever standard tools they are already familiar with to manipulate their media, making integration with other systems and other parts of their websites much easier.
Who is using Media Entity?
For being a new module, Media Entity is getting a lot of traction. Alongside the ca. 1500 sites it’s currently running on, it is used on Othello, the enterprise plublishing patform that Janez helped build for Examiner.com and axs.com. For more on this, check out his session from DrupalCamp Vienna 2015 - How we built an Enterprise Media Publishing Platform on D8.
How did this Drupal 8 module come to be?
“The idea initially appeared at DrupalCon Prague in 2013 and we started working on it shortly after that,” Janez and his fellow contributors had a lot of important work ahead of them. “Media Entity solves storage and metadata handling of local and remote media resources. We were building one of the most important, fundamental components of the overall media ecosystem. It took more than two years to get from the initial commit to the 8.x-1.0 release.”
Thank you sponsors and contributors
“Thank you for supporting the development of Media Entity, Drupal NYC camp, Examiner.com, MD Systems, Acquia's Drupal 8 Module Acceleration Program, and many smaller contributors.”