Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "James Gollan d.o: gollyg twitter: gollyg. Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site."— Presentation transcript:

1 James Gollan d.o: gollyg twitter: gollyg

2 Overview Files in Drupal 7 The media suite of modules Site recipe: Adding media to your site

3

4

5

6

7

8 Files in Drupal 7

9 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

10 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)

11 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

12 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

13 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...

14 The Media module

15 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

16 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...

17 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

18 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

19 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

20 Site recipe: Adding media to your site

21 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

22 Setup Oh, and this patch :-| http://drupal.org/node/1141374 and this extra little bit of code... https://gist.github.com/1124045

23 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

24 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.

25 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.

26 Configure input formats and CKeditor Download CKeditor to libraries folder Add media filter Add button to CKeditor Enable correct input format

27 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)

28 Find out more http://drupal.org/media http://drupal.org/mediaelementelement http://drupal.org/documentation/modules/media http://drupal.org/docu irc: #drupal-mediarupal-media

29


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

Similar presentations


Ads by Google