/[drupal]/contributions/modules/video_upload/video_upload.field.inc
ViewVC logotype

Contents of /contributions/modules/video_upload/video_upload.field.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Sun Oct 11 22:06:52 2009 UTC (6 weeks, 5 days ago) by jhedstrom
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-7--1
File MIME type: text/x-php
Initital 7.x port.
1 <?php
2
3 // $Id$
4
5 /**
6 * @file
7 * Defines a "video upload" field type.
8 */
9
10 /**
11 * Implement hook_field_info().
12 */
13 function video_upload_field_info() {
14 $file = module_invoke('file', 'field_info');
15 $video = array(
16 'video_upload' => array(
17 'label' => t('Video Upload'),
18 'description' => t('Upload and send video to a 3rd-party provider.'),
19 'default_widget' => 'video_upload_widget',
20 'default_formatter' => 'video_upload_default',
21 ),
22 );
23 $video['video_upload']['settings'] = $file['file']['settings'];
24 $video['video_upload']['instance_settings'] = $file['file']['instance_settings'];
25 $video['video_upload']['instance_settings']['file_extensions'] = 'mov avi mp4 mpa mpe mpg mpeg qt wmv';
26
27 return $video;
28 }
29
30 /**
31 * Implement hook_field_schema().
32 */
33 function video_upload_field_schema($field) {
34 $return = file_field_schema($field);
35 $return['columns'] += array(
36 // The provider ID.
37 'video_id' => array(
38 'type' => 'varchar',
39 'length' => 32,
40 ),
41 // Video status.
42 'video_status' => array(
43 'type' => 'varchar',
44 'length' => 32,
45 'default' => VIDEO_UPLOAD_STATUS_UPLOAD_PENDING,
46 'sortable' => TRUE,
47 ),
48 // Time of status update.
49 'video_status_ts' => array(
50 'type' => 'int',
51 'length' => 11,
52 'sortable' => TRUE,
53 'default' => '0',
54 ),
55 );
56 $return['indexes'] += array(
57 'video_status' => array('video_status'),
58 );
59 return $return;
60 }
61
62 /**
63 * Implement hook_field().
64 */
65 function video_upload_field($op, $node, $field, &$items, $teaser, $page) {
66 // Nothing different from FileField, so simply do what FileField does.
67 $return = filefield_field($op, $node, $field, $items, $teaser, $page);
68 return $return;
69 }
70 /**
71 * Implement hook_field_formatter_info().
72 */
73 function video_upload_field_formatter_info() {
74 return array(
75 'video_upload_default' => array(
76 'label' => t('Default'),
77 'field types' => array('video_upload'),
78 'description' => t('Displays fullsize video as defined in the field settings.'),
79 ),
80 'video_upload_thumb' => array(
81 'label' => t('Thumbnail image'),
82 'field types' => array('video_upload'),
83 'description' => t('Image thumbnail of the dimensions defined in the field settings.'),
84 ),
85 'video_upload_thumb_link' => array(
86 'label' => t('Thumbnail image as link to node'),
87 'field types' => array('video_upload'),
88 'description' => t('Thumbnail image linking to video node.'),
89 ),
90 'video_upload_small' => array(
91 'label' => t('Small Video'),
92 'field types' => array('video_upload'),
93 'description' => t('Small video as defined in the field settings.'),
94 ),
95 );
96 }
97
98 /**
99 * Implement hook_field_settings_form().
100 */
101 function video_upload_field_settings_form($field, $instance, $has_data) {
102 $form = module_invoke('file', 'field_settings_form', $field, $instance, $has_data);
103 unset($form['default_file']);
104 return $form;
105 }

  ViewVC Help
Powered by ViewVC 1.1.2