extending media presentation

38
Extending Media Module www.wearepropeople.com Improve your web authors experience by Alexei Gorobets

Upload: alexei-gorobets

Post on 08-May-2015

394 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Extending media presentation

Extending Media Module

www.wearepropeople.com

Improve your web authors experience

by Alexei Gorobets

Page 2: Extending media presentation

www.wearepropeople.com

Long time ago in a galaxy far far away…

Page 3: Extending media presentation

www.wearepropeople.com

How do you manage media in Drupal?

Page 4: Extending media presentation

www.wearepropeople.com

Administrator •  Many modules to use, every module with it’s own features •  Complex for new users, no simple solutions •  No way to integrate all solutions with WYSIWYG •  Training required in most cases •  No way to reuse uploaded content

Page 5: Extending media presentation

www.wearepropeople.com

Developer •  Every module provides it’s own solution for the problem •  Many new field typex and many new widgets for the same idea •  Tons of modules that implement the same in different aspects •  No way to manage your files in cloud (S3, CDN) •  No consistent API to extend existing solutions

Page 6: Extending media presentation

www.wearepropeople.com

Where is the user is this maze?

Page 7: Extending media presentation

www.wearepropeople.com

Let’s be honest…

It’s Wordpress 2.7 released in 2008

Page 8: Extending media presentation

www.wearepropeople.com

Let’s be honest…

It’s Drupal 7 in January 2011

Page 9: Extending media presentation

www.wearepropeople.com

Here comes Media Module

Page 10: Extending media presentation

www.wearepropeople.com

First…

Get use of D7 new Entity API to create File entity

Page 11: Extending media presentation

www.wearepropeople.com

Second…

Make file types (Image, File, Video, Text) as entity bundles and they are fieldable

Page 12: Extending media presentation

www.wearepropeople.com

More…

•  Integrate files in WYSIWYG •  Reuse your files by browsing your Library •  Use different formatters to display your files •  Consistent API to extend for developers •  Use StreamWrappers from D7

Page 13: Extending media presentation

www.wearepropeople.com

StreamWrappers?

•  Use url like s3:// and youtube:// to access remote files •  Remote and local files are treated the same way •  Easy way to add new wrappers

Page 14: Extending media presentation

www.wearepropeople.com

Looks better?

Page 15: Extending media presentation

www.wearepropeople.com

Insert into WYSIWYG

Page 16: Extending media presentation

www.wearepropeople.com

Upload new or select from library

Page 17: Extending media presentation

www.wearepropeople.com

Select a formatter

Page 18: Extending media presentation

www.wearepropeople.com

Image inserted

Page 19: Extending media presentation

www.wearepropeople.com

How it’s handled behind the scenes

Page 20: Extending media presentation

www.wearepropeople.com

Every tab is a plugin. Create your own!

Page 21: Extending media presentation

www.wearepropeople.com

Different file types!

Page 22: Extending media presentation

www.wearepropeople.com

Fieldable file types!

Page 23: Extending media presentation

www.wearepropeople.com

But! Most valuable is the API!

Page 24: Extending media presentation

www.wearepropeople.com

Create your Media Browser from Views

Page 25: Extending media presentation

www.wearepropeople.com

Create your Media Browser from Views

Page 26: Extending media presentation

www.wearepropeople.com

or create a class…

Page 27: Extending media presentation

www.wearepropeople.com

For example:

Page 28: Extending media presentation

www.wearepropeople.com

Meet hook_media_browser_plugins_alter().

Page 29: Extending media presentation

www.wearepropeople.com

Add upload forms for each media browser

Page 30: Extending media presentation

www.wearepropeople.com

Add upload forms for each media browser

Page 31: Extending media presentation

www.wearepropeople.com

What else? Back to Wordpress!

Page 32: Extending media presentation

www.wearepropeople.com

We want to edit file attributes on file upload

•  Set a proper file name •  Assign OG audience to the file •  Set other usefull attributes

Page 33: Extending media presentation

www.wearepropeople.com

Let’s alter the forms

Set our submit callback instead of default

Page 34: Extending media presentation

www.wearepropeople.com

Let’s alter the forms

Set redirects using media-popup setting in query

Page 35: Extending media presentation

www.wearepropeople.com

Let’s alter the forms Alter file attributes form, remove fields, make Cancel button work!

Page 36: Extending media presentation

www.wearepropeople.com

Let’s go for a demo!

Page 37: Extending media presentation

www.wearepropeople.com

Questions?

Page 38: Extending media presentation

www.wearepropeople.com

Thanks!