extending media presentation
TRANSCRIPT
![Page 1: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/1.jpg)
Extending Media Module
www.wearepropeople.com
Improve your web authors experience
by Alexei Gorobets
![Page 2: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/2.jpg)
www.wearepropeople.com
Long time ago in a galaxy far far away…
![Page 3: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/3.jpg)
www.wearepropeople.com
How do you manage media in Drupal?
![Page 4: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/4.jpg)
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](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/5.jpg)
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](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/6.jpg)
www.wearepropeople.com
Where is the user is this maze?
![Page 7: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/7.jpg)
www.wearepropeople.com
Let’s be honest…
It’s Wordpress 2.7 released in 2008
![Page 8: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/8.jpg)
www.wearepropeople.com
Let’s be honest…
It’s Drupal 7 in January 2011
![Page 9: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/9.jpg)
www.wearepropeople.com
Here comes Media Module
![Page 10: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/10.jpg)
www.wearepropeople.com
First…
Get use of D7 new Entity API to create File entity
![Page 11: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/11.jpg)
www.wearepropeople.com
Second…
Make file types (Image, File, Video, Text) as entity bundles and they are fieldable
![Page 12: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/12.jpg)
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](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/13.jpg)
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](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/14.jpg)
www.wearepropeople.com
Looks better?
![Page 15: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/15.jpg)
www.wearepropeople.com
Insert into WYSIWYG
![Page 16: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/16.jpg)
www.wearepropeople.com
Upload new or select from library
![Page 17: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/17.jpg)
www.wearepropeople.com
Select a formatter
![Page 18: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/18.jpg)
www.wearepropeople.com
Image inserted
![Page 19: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/19.jpg)
www.wearepropeople.com
How it’s handled behind the scenes
![Page 20: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/20.jpg)
www.wearepropeople.com
Every tab is a plugin. Create your own!
![Page 21: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/21.jpg)
www.wearepropeople.com
Different file types!
![Page 22: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/22.jpg)
www.wearepropeople.com
Fieldable file types!
![Page 23: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/23.jpg)
www.wearepropeople.com
But! Most valuable is the API!
![Page 24: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/24.jpg)
www.wearepropeople.com
Create your Media Browser from Views
![Page 25: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/25.jpg)
www.wearepropeople.com
Create your Media Browser from Views
![Page 26: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/26.jpg)
www.wearepropeople.com
or create a class…
![Page 27: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/27.jpg)
www.wearepropeople.com
For example:
![Page 28: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/28.jpg)
www.wearepropeople.com
Meet hook_media_browser_plugins_alter().
![Page 29: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/29.jpg)
www.wearepropeople.com
Add upload forms for each media browser
![Page 30: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/30.jpg)
www.wearepropeople.com
Add upload forms for each media browser
![Page 31: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/31.jpg)
www.wearepropeople.com
What else? Back to Wordpress!
![Page 32: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/32.jpg)
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](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/33.jpg)
www.wearepropeople.com
Let’s alter the forms
Set our submit callback instead of default
![Page 34: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/34.jpg)
www.wearepropeople.com
Let’s alter the forms
Set redirects using media-popup setting in query
![Page 35: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/35.jpg)
www.wearepropeople.com
Let’s alter the forms Alter file attributes form, remove fields, make Cancel button work!
![Page 36: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/36.jpg)
www.wearepropeople.com
Let’s go for a demo!
![Page 37: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/37.jpg)
www.wearepropeople.com
Questions?
![Page 38: Extending media presentation](https://reader035.vdocuments.net/reader035/viewer/2022081400/554bdf50b4c905706a8b580a/html5/thumbnails/38.jpg)
www.wearepropeople.com
Thanks!