Media in Drupal 8:

EVERYTHING YOU NEED TO KNOW

https://slides.com/phenaproxima/d8media

phenaproxima

  • Senior Software Engineer @ Acquia
  • Media Initiative coordinator 
  • Media system co-maintainer
  • Lightning distro maintainer
  • The loud guy in the contribution room

OVERVIEW

  • Purpose and architecture
  • Media vs. file/image fields
  • Live demo! 😱
  • Useful modules
  • What's next?
  • Q+A

THE MEDIA SYSTEM

Two purposes. Two modules.

  1. Media: Represent media as Drupal entities
  2. Media Library: Make media reusable in the UI

Media is the plumbing; Media Library is the UI.

MEDIA ITEMS ARE ENTITIES

  • They have all the superpowers!
    • fieldable
    • revisionable
    • translatable
    • themeable
    • ...etc.​
  • Media items have types
  • ...are generally similar to content types
  • ...have a source (kind of media)
  • ...have a "source field" to store the most important data

MEDIA TYPES...

All media have a value in their source field.

  • Media can be a LOT more than images
  • Images, and other media, are reusable
  • Brings power, flexibility, and consistency

WHY THIS IS GOOD

...but yes, it is a little more complicated.

IMAGE FIELD

node

image field

node

image field

media

MEDIA FIELD

MEDIA LIBRARY

  • Finally!
  • Author-facing UI for selecting and adding media
  • Simple, usable, accessible
  • Nearly zero configuration
  • Customizable to a degree
  • Integrates with CKEditor (!)
  • Can be integrated with other things too

BUT...it only works with media. 😇

LET US RECAP

  • Media:
    • are entities
    • have a type
    • have a special field to store Important Stuff
    • can be more than just images
  • Image fields: content owns image
  • Media fields: media owns image; content references media
  • Media Library only works with media

LIVE DEMO!

TWO USEFUL MODULES

(and one useless one)

👍 USEFUL MODULE:

ENTITY BROWSER

  • Generic and open-ended
  • Needs a lot of set-up
  • Harder to make usable and accessible
  • Peacefully coexists with core tools
  • More complicated; good for unusual use cases
  • Generic and open-ended
  • Needs a lot of set-up
  • Peacefully coexists with core tools
  • More complicated; better for unusual use cases

👍 USEFUL MODULE:

ENTITY EMBED

  • Obsolete; moved into core
  • Big ecosystem...most of which now uses core tools
  • Version 2 is an update path to core Media

Please don't use this module.

👎 USELESS MODULE:

MEDIA ENTITY

WHAT'S NEXT?

  • Fix all the bugs
  • Migration path from files and images
  • Replace File & Image modules?
  • Adding Media and Media Library core OOTB

Questions??

THANK YOU!!!

@phenaproxima

 

drupal.org/u/phenaproxima

 

slides.com/phenaproxima/d8media

Media in Drupal 8: Everything you need to know

By Adam G-H

Media in Drupal 8: Everything you need to know

  • 18
Loading comments...

More from Adam G-H