Media ecosystem in Drupal 8

Janez Urevc / @slashrsm / http://janezurevc.name
Dave Reid / @davereid / http://davereid.net

http://slashrsm.github.io/media_austin

Who are we?

Janez Urevc - @slashrsm

Why is media important for Drupal

  • people expect that we do it right
  • our "competitors" handle this "better" than we do
  • we have lots of enterprise media companies using Drupal
  • people expect media-rich websites
  • site editors expect lean & efficient media creation/organization process
  • we simply need to handle media well
"If I could snap my fingers and add one single feature to Drupal core it would be good Media handling."
Dries Buytaert @ DrupalCon Portland

D8?

Problems

Media module (we have many)

  • no stable Media 2.x release
  • WYSIWYG handling and regressions
  • overly-complex out of the box (configuring file display)
  • uphill battle against core assumptions and flexibility
  • sustained maintainership
  • and more!

Scald module

  • Fights for resources and volunteers with Media, no shared work

Basic concepts discussion

There are still some disagreements... but we agree that we disagree! https://groups.drupal.org/node/384813

Photo by Paul O'Donoghue - https://flic.kr/p/cYQVgo

Sprint at NYC DrupalCamp

https://groups.drupal.org/node/418803

We keep working on two separate storage components

Apparently there is need for two different storage approaches (file_entity and media_entity).

Decouple the ecosystem into independent parts

  • Each independent component should be able to work with both storage approaches
  • That usually means they can be used also in non-media context
  • Entity WYSIWYG embed (entity_embed) - Google Summer of code project
  • Entity browser (entity_browser)
  • Fallback formatter (fallback_formatter)

Component: Entity Browser

https://www.drupal.org/project/entity_browser

  • general entity browsing tool
  • plug-gable
  • can be used in different contexts
  • based on what you can see in D7 but done in a more flexible way

Component: Entity Browser

Potential use cases

  • find and add 3 related articles
  • upload 5, select 3 existing images and add all of them to a gallery
  • find a YouTube video and embed it into WYSIWYG
  • find and send 50 articles to a remote service
  • you name it!

Component: Entity Browser

Component: Entity Browser

Component: Entity Browser

drupal.org/node/2289821

Component: Media Entity

https://www.drupal.org/project/media_entity

  • storage component that uses "not everything is a file" approach
  • creates an entity type from ground up
  • uses fields to store different types of media
  • not necessary to store all media as local files (in file_managed) table

Component: Media Entity

Media type plugins

  • handles various media types: business logic, validation, meta-data, ...
  • validation: exposes validation callback that can be used in form, custom code, ...
  • meta-data: list of "fields" that are provided
  • mapping to entity fields can be defined (and done automatically)
  • can be used at display time
  • ...

Component: Media entity

Component: Media entity

Component: Entity Embed

https://www.drupal.org/project/entity_embed

  • Configurable buttons, works for all entity types
  • Uses field formatters for entity reference fields
  • Serialized into data attributes in an HTML tag
  • Supports UUIDs

Component: Embedding

Embed framework/API

Entity embed

URL embed

Shortcode embed

Field embed

Component: File Entity

Started planning a decoupled approach and focus on core problem areas from ground-up.


Split up File Entity into smaller chunks for fieldable files, file types, download formatter, fallback behavior.

Component: Fallback formatter

https://www.drupal.org/project/fallback_formatter

Component: Reusable formatters

https://www.drupal.org/project/file_image_formatters

Component: Field formatter

httsp://www.drupal.org/project/field_formatter

What happens to the Media/Scald modules in D8?

Config entities, Views, etc to bring all these components together, pre-configured out of the box for the 80% use case.

Challenges in Drupal 8

Challenges in D8

External dependencies for contrib

#1398772: Consider composer.json to manage dependencies instead of .info files

Challenges in D8

Using formatters and widgets on data without any real fields

Lack of actual decoupling in core.

Too many fields? File, image, and entity reference?

#2274169: EntityViewBuilder::viewField() / viewFieldItem() don't work for arbitrary added field values

#1448124: Image dimensions should be available from file_load() for images, and not stored in field data

#2271349: Node and Comment links should be display components

Challenges in D8

Files lack proper access controller

#2078473: Use entity access API for checking access to private files

#2148353: File access (hook_file_download) does not use an EntityAccessController

Challenges in D8

Typed Data and Plugins

#2278073: Files with spaces in URIs fail entity TypedData validation

#2277981: Provide a service for handling context-aware plugins

Challenges in D8

File usage system deletes your files

Temporary means both uploaded but not saved to content, and also was used but now is not.

We need help!

This is not going to magically happen. We need your help in order to succeed.

We need people of various expertise

  • frontend
  • UX
  • interface design
  • backend
  • project mgmt
  • ideas, past experience
  • You name it!

How to get involved?

Thank you!

Questions?

Janez Urevc / @slashrsm / http://janezurevc.name
Dave Reid / @davereid / http://davereid.net