james gollan d.o: gollyg twitter: gollyg. overview files in drupal 7 the media suite of modules site...

29
James Gollan d.o: gollyg twitter: gollyg QuickTime™ and a DVCPRO - PAL decompressor are needed to see this picture.

Upload: whitney-murphy

Post on 22-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

James Golland.o: gollygtwitter: gollyg

QuickTime™ and aDVCPRO - PAL decompressor

are needed to see this picture.

Page 2: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Overview

• Files in Drupal 7

• The media suite of modules

• Site recipe: Adding media to your site

Page 3: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site
Page 4: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site
Page 5: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site
Page 6: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site
Page 7: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

QuickTime™ and aH.264 decompressor

are needed to see this picture.

Page 8: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Files in Drupal 7

Page 9: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Drupal 7 - File entities

• Files in Drupal 7 are handled as entities

• Files are attached using a file field (or an image field)

• This creates an entity reference to the file

Page 10: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Managed vs unmanaged files

• The File API provides functionality for working with files

• Files can be 'managed' or 'unmanaged'

• Managed files have a corresponding entry in the 'file_managed' table

• Operations on managed files update this table

• Unmanaged files are not 'known' to Drupal, and cannot be referenced or re-used (except via raw links)

Page 11: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Stream wrappers

• A stream is simply a resource object

• Drupal stream wrappers are an extension of PHP's stream wrapper functionality

• Stream wrappers are referred to using a standard pattern:

scheme://target

• core stream wrappers include:

• public://

• private://

• temp://

• PHP also provides a number of stream wrappers

Page 12: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

File usage

• Drupal 7 tracks file usage, and will lock a file that is currently in use by making an entry in the 'file_usage' table

• "In use" means that it is referenced from a node

• This prevents accidental file deletion, and allows for better file management

Page 13: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

That's all great, but...

• File entities are NOT field-able

• File entities are not easily re-usable

• There is no interface for managing file entities

• enter...

Page 14: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

The Media module

Page 15: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Media Module

“Media's aim is to solve Drupal's long standing media handling problem.”

“The framework provided by the Media module is helping to unify many of the current multimedia and file efforts, acting as a springboard to future development.”http://drupal.org/documentation/modules/media

Page 16: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Current state

Media currently has 2 main branches:•7.x-1.x (currently at RC3)•7.x-2.x (currently unstable)

•dependency on file_entity module...

Page 17: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

File entity module

• Makes files field-able. (Yay)!

• Makes files re-usable. (Yay * 2)!

• Provides an administrative interface for files on the system

• Provides a UI for managing file display modes

Page 18: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

File_entity module (cont.)

• Defines 6 file_entity bundles, based upon common MIME types:

• video

• image

• audio

• text

• application

• other

• Places files into one of the above bundles, based upon file extension

Page 19: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Media module

• Provides a unified and extensible widget for handling file uploads

• Provides a formatter for displaying file_entities of any type

• Provides various api functions for integrating with core file handling, file styles, stream wrappers, and making the whole system pluggable with extra file providers

Page 20: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Site recipe: Adding media to your site

Page 21: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Setup

• Use the following modules:

• Media (7.x-2.x branch)

• mediaelement (mediaelement 7.x-1.x-dev)

• libraries

• media_youtube

• ckeditor (the library, not the module)

• wysiwyg

• file_element

Page 22: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Setup

• Oh, and this patch :-|

• http://drupal.org/node/1141374

• and this extra little bit of code...

• https://gist.github.com/1124045

Page 23: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Configure the node bundle

• Add a file field to a content type

• Select the 'media' formatter

• From the node display page, set the file field display configuration to ‘Media’ and choose an appropriate view mode for the field display

Page 24: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Configure the file display

• Visit the file management screen.

• From the ‘Manage file display’ link, assign the correct formatters for the file. Note that you can assign more than one formatter to a file - the first applicable formatter will be applied.

• Change the display on the node type to refer to the correct display mode.

Page 25: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Adding metadata

• Visit the file management screen.

• From the ‘Manage fields’ link. Add any fields that you want on the file bundle.

• Change the display on the node type to refer to the correct display mode.

Page 26: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Configure input formats and CKeditor

• Download CKeditor to libraries folder

• Add media filter

• Add button to CKeditor

• Enable correct input format

Page 27: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Drawbacks

• File access still not implemented

• Files inserted via the WYSISYG are not inserted into the file_usage table, meaning that accidental deletion is possible, and there is no easy way of auditing these files

• No option to add meta-data when uploading a file

• Browsing a large number of files in the widget difficult

• Many functions and features still a *bit* fragile (currently over 100 open bugs)

Page 28: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

Find out more•http://drupal.org/media•http://drupal.org/mediaelement•http://drupal.org/documentation/modules/media•irc: #drupal-media

Page 29: James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

QuickTime™ and a decompressor

are needed to see this picture.