/[drupal]/contributions/modules/emfield/contrib/video_cck/video_cck.module
ViewVC logotype

Contents of /contributions/modules/emfield/contrib/video_cck/video_cck.module

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


Revision 1.16 - (show annotations) (download) (as text)
Mon May 18 14:45:51 2009 UTC (6 months, 1 week ago) by aaron
Branch: MAIN
CVS Tags: HEAD
Changes since 1.15: +9 -1 lines
File MIME type: text/x-php
Fix potential problem with missing thumbnail links (aaron).
1 <?php
2 // $Id: video_cck.module,v 1.15 2009/03/11 14:55:12 aaron Exp $
3
4 define('VIDEO_CCK_DEFAULT_VIDEO_WIDTH', 425);
5 define('VIDEO_CCK_DEFAULT_VIDEO_HEIGHT', 350);
6 define('VIDEO_CCK_DEFAULT_PREVIEW_WIDTH', 425);
7 define('VIDEO_CCK_DEFAULT_PREVIEW_HEIGHT', 350);
8 define('VIDEO_CCK_DEFAULT_THUMBNAIL_WIDTH', 120);
9 define('VIDEO_CCK_DEFAULT_THUMBNAIL_HEIGHT', 90);
10
11 /**
12 * Implement hook_emfield_info
13 */
14 function video_cck_emfield_info() {
15 $name = t('Embedded Video Field');
16 return array(
17 '#name' => $name,
18 '#settings_description' => t('The following settings configure content with any fields controlled by @name.', array('@name' => $name)),
19 );
20 }
21
22 /**
23 * Implement hook_settings
24 */
25 function video_cck_emfield_settings() {
26 $form = array();
27 return $form;
28 }
29
30 /**Implementation of hook_field_info **/
31
32 function video_cck_field_info() {
33 $fields = array(
34 'video_cck' => array('label' => t('Embedded Video')),
35 );
36 return $fields;
37 }
38
39 /** Implementation of hook_field_settings **/
40
41 function video_cck_field_settings($op, $field) {
42 switch ($op) {
43
44 case 'database columns':
45 $columns = array(
46 'embed' => array('type' => 'longtext', 'not null' => TRUE, 'default' => "''", 'sortable' => TRUE),
47 'value' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''", 'sortable' => TRUE),
48 'provider' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => "''", 'sortable' => TRUE),
49 'data' => array('type' => 'longtext', 'not null' => TRUE, 'default' => "''", 'sortable' => false),
50 );
51 switch ($field['type']) {
52 case 'video_cck':
53 break;
54 }
55 return $columns;
56 break;
57 case 'filters':
58 return array(
59 'not null' => array(
60 'name' => t('Has Embedded Video'),
61 'operator' => array('=' => t('Has Embedded Video')),
62 'list' => 'views_handler_operator_yesno',
63 'list-type' => 'select',
64 'handler' => 'emfield_views_handler_filter_is_not_null',
65 'help' => t('Selecting yes will choose only nodes with this field that successfully provide an embedded video.'),
66 ),
67 'provider' => array(
68 'name' => t('Video Provider'),
69 'list' => 'emfield_views_handler_filter_provider_list',
70 'list-type' => 'list',
71 'operator' => 'views_handler_operator_or',
72 'value-type' => 'array',
73 'handler' => 'emfield_views_handler_filter_provider',
74 'help' => t('Include or exclude videos from the selected provider.'),
75 ),
76 );
77 break;
78 case 'arguments':
79 return array(
80 'content: '. $field['field_name'] => array(
81 'name' => t('Embedded Video: @widget (@field)', array('@widget' => $field['widget']['label'], '@field' => $field['field_name'])),
82 'handler' => 'content_views_argument_handler',
83 'help' => t('This is the default argument handler provided by CCK. It uses the original embed code or URL pasted into the field.'),
84 ),
85 'provider: '. $field['field_name'] => array(
86 'name' => t('Embedded Video Provider: @widget (@field)', array('@widget' => $field['widget']['label'], '@field' => $field['field_name'])),
87 'handler' => 'video_cck_handler_arg_provider',
88 'help' => t('The Embedded Video Provider argument allows users to filter a view by specifying the video provider.'),
89 ),
90 );
91 break;
92 }
93 }
94
95 //** Implementation of hook_field **/
96 function video_cck_field($op, &$node, $field, &$items, $teaser, $page) {
97 if (module_hook('emfield', 'emfield_field')) {
98 return emfield_emfield_field($op, $node, $field, $items, $teaser, $page, 'video_cck');
99 }
100 }
101
102 /** Implementation of hook_field_formatter_info **/
103 function video_cck_field_formatter_info() {
104 $types = array('video_cck', );
105 $formats = array(
106 'default' => array(
107 'label' => t('Default'),
108 'field types' => $types,
109 ),
110 'video_video' => array(
111 'label' => t('Full Size Video'),
112 'field types' => $types,
113 ),
114 'video_preview' => array(
115 'label' => t('Preview Video'),
116 'field types' => $types,
117 ),
118 'video_thumbnail' => array(
119 'label' => t('Image Thumbnail'),
120 'field types' => $types,
121 ),
122 'video_embed' => array(
123 'label' => t('Embed Code'),
124 'field types' => $types,
125 ),
126 );
127 // add thickbox formatter if thickbox module exists
128 if (module_exists('thickbox')) {
129 $formats['thickbox'] = array(
130 'label' => t('Thickbox: Image Thumbnail -> Full Size Video'),
131 'field types' => $types,
132 );
133 }
134 return $formats;
135 }
136
137 /** Implementation of hook_field_formatter **/
138 function video_cck_field_formatter($field, $item, $formatter, $node) {
139 return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'video_cck');
140 }
141
142 /** Widgets **/
143
144 /** Implementation of hook_widget_info **/
145 function video_cck_widget_info() {
146 return array(
147 'video_cck_textfields' => array(
148 'label' => t('3rd Party Video'),
149 'field types' => array('video_cck', ),
150 ),
151 );
152 }
153
154 function video_cck_widget_settings($op, $widget) {
155 switch ($op) {
156 case 'form':
157 if ($widget['type'] == 'video_cck_textfields') {
158 $form = (array)module_invoke('emfield', 'emfield_widget_settings', 'form', $widget, 'video_cck');
159 $width = variable_get('video_cck_default_video_width', VIDEO_CCK_DEFAULT_VIDEO_WIDTH);
160 $height = variable_get('video_cck_default_video_height', VIDEO_CCK_DEFAULT_VIDEO_HEIGHT);
161 $form['video'] = array(
162 '#type' => 'fieldset',
163 '#title' => t('Video Display Settings'),
164 '#description' => t('These settings control how this video is displayed in its full size, which defaults to @widthx@height.', array('@width' => $width, '@height' => $height)),
165 '#collapsible' => true,
166 '#collapsed' => false,
167 );
168 $form['video']['video_width'] = array(
169 '#type' => 'textfield',
170 '#title' => t('Video display width'),
171 '#default_value' => $widget['video_width'] ? $widget['video_width'] : $width,
172 '#required' => true,
173 '#description' => t('The width of the video. It defaults to @width.', array('@width' => $width)),
174 );
175 $form['video']['video_height'] = array(
176 '#type' => 'textfield',
177 '#title' => t('Video display height'),
178 '#default_value' => $widget['video_height'] ? $widget['video_height'] : $height,
179 '#required' => true,
180 '#description' => t('The height of the video. It defaults to @height.', array('@height' => $height)),
181 );
182 $form['video']['video_autoplay'] = array(
183 '#type' => 'checkbox',
184 '#title' => t('Autoplay'),
185 '#default_value' => $widget['video_autoplay'] ? $widget['video_autoplay'] : false,
186 '#description' => t('If supported by the provider, checking this box will cause the video to automatically begin after the video loads when in its full size.'),
187 );
188
189 $width = variable_get('video_cck_default_preview_width', VIDEO_CCK_DEFAULT_PREVIEW_WIDTH);
190 $height = variable_get('video_cck_default_preview_height', VIDEO_CCK_DEFAULT_PREVIEW_HEIGHT);
191 $form['preview'] = array(
192 '#type' => 'fieldset',
193 '#title' => t('Video Preview Settings'),
194 '#description' => t('These settings control how this video is displayed in its preview size, which defaults to @widthx@height.', array('@width' => $width, '@height' => $height)),
195 '#collapsible' => true,
196 '#collapsed' => false,
197 );
198 $form['preview']['preview_width'] = array(
199 '#type' => 'textfield',
200 '#title' => t('Video preview width'),
201 '#default_value' => $widget['preview_width'] ? $widget['preview_width'] : variable_get('video_cck_default_preview_width', VIDEO_CCK_DEFAULT_PREVIEW_WIDTH),
202 '#required' => true,
203 '#description' => t('The width of the preview video. It defaults to @width.', array('@width' => $width)),
204 );
205 $form['preview']['preview_height'] = array(
206 '#type' => 'textfield',
207 '#title' => t('Video preview height'),
208 '#default_value' => $widget['preview_height'] ? $widget['preview_height'] : variable_get('video_cck_default_preview_height', VIDEO_CCK_DEFAULT_PREVIEW_HEIGHT),
209 '#required' => true,
210 '#description' => t('The height of the preview video. It defaults to @height.', array('@height' => $height)),
211 );
212 $form['preview']['preview_autoplay'] = array(
213 '#type' => 'checkbox',
214 '#title' => t('Autoplay'),
215 '#default_value' => $widget['preview_autoplay'] ? $widget['preview_autoplay'] : false,
216 '#description' => t('If supported by the provider, checking this box will cause the video to automatically begin after the video loads when in its preview size.'),
217 );
218
219 $width = variable_get('video_cck_default_thumbnail_width', VIDEO_CCK_DEFAULT_THUMBNAIL_WIDTH);
220 $height = variable_get('video_cck_default_thumbnail_height', VIDEO_CCK_DEFAULT_THUMBNAIL_HEIGHT);
221 $form['tn'] = array(
222 '#type' => 'fieldset',
223 '#title' => t('Thumbnail'),
224 '#description' => t('When displayed as a thumbnail, these settings control the image returned. Note that not all 3rd party video content providers offer thumbnails, and others may require an API key or other requirements. More information from the !settings. The default size for thumbnails is @widthx@height.', array('!settings' => l(t('settings page'), 'admin/content/emfield'), '@width' => $width, '@height' => $height)),
225 '#collapsible' => true,
226 '#collapsed' => false,
227 );
228 $form['tn']['thumbnail_width'] = array(
229 '#type' => 'textfield',
230 '#title' => t('Thumbnail width'),
231 '#default_value' => $widget['thumbnail_width'] ? $widget['thumbnail_width'] : variable_get('video_cck_default_thumbnail_width', VIDEO_CCK_DEFAULT_THUMBNAIL_WIDTH),
232 '#required' => true,
233 '#description' => t('The width of the thumbnail. It defaults to @width.', array('@width' => $width)),
234 );
235 $form['tn']['thumbnail_height'] = array(
236 '#type' => 'textfield',
237 '#title' => t('Thumbnail height'),
238 '#default_value' => $widget['thumbnail_height'] ? $widget['thumbnail_height'] : variable_get('video_cck_default_thumbnail_height', VIDEO_CCK_DEFAULT_THUMBNAIL_HEIGHT),
239 '#required' => true,
240 '#description' => t('The height of the thumbnail. It defaults to @height.', array('@height' => $height)),
241 );
242 if (!module_exists('emthumb')) {
243 $tn_desc = t(' You may be interested in activating the Embedded Media Thumbnails module as well, which will allow you to specify custom thumbnails on a per-node basis.');
244 }
245 $form['tn']['thumbnail_default_path'] = array(
246 '#type' => 'textfield',
247 '#title' => t('Default thumbnail path'),
248 '#default_value' => $widget['thumbnail_default_path'] ? $widget['thumbnail_default_path'] : variable_get('video_cck_default_thumbnail_path', ''),
249 '#description' => t('Path to a local default thumbnail image for cases when a thumbnail can\'t be found. For example, you might have a default thumbnail at %files.', array('%files' => 'files/thumbnail.png')) . $tn_desc,
250 );
251 }
252 return $form;
253
254 case 'validate':
255 if ($widget['type'] == 'video_cck_textfields') {
256 if (!is_numeric($widget['video_width']) || intval($widget['video_width']) != $widget['video_width'] || $widget['video_width'] < 1) {
257 form_set_error('video_width', t('"Video width" must be a positive integer.'));
258 }
259 if (!is_numeric($widget['video_height']) || intval($widget['video_height']) != $widget['video_height'] || $widget['video_height'] < 1) {
260 form_set_error('video_height', t('"Video height" must be a positive integer.'));
261 }
262 if (!is_numeric($widget['preview_width']) || intval($widget['preview_width']) != $widget['preview_width'] || $widget['preview_width'] < 1) {
263 form_set_error('preview_width', t('"Preview width" must be a positive integer.'));
264 }
265 if (!is_numeric($widget['preview_height']) || intval($widget['preview_height']) != $widget['preview_height'] || $widget['preview_height'] < 1) {
266 form_set_error('preview_height', t('"Preview height" must be a positive integer.'));
267 }
268 if (!is_numeric($widget['thumbnail_width']) || intval($widget['thumbnail_width']) != $widget['thumbnail_width'] || $widget['thumbnail_width'] < 1) {
269 form_set_error('thumbnail_width', t('"Thumbnail width" must be a positive integer.'));
270 }
271 if (!is_numeric($widget['thumbnail_height']) || intval($widget['thumbnail_height']) != $widget['thumbnail_height'] || $widget['thumbnail_height'] < 1) {
272 form_set_error('thumbnail_height', t('"Thumbnail height" must be a positive integer.'));
273 }
274 }
275 break;
276
277 case 'save':
278 if ($widget['widget']['type'] == 'video_cck_textfields') {
279 $columns = array('video_width', 'video_height', 'video_autoplay', 'preview_width', 'preview_height', 'preview_autoplay', 'thumbnail_width', 'thumbnail_height', 'thumbnail_default_path', );
280 $columns = array_merge($columns, module_invoke('emfield', 'emfield_widget_settings', 'save', $widget, 'video_cck'));
281 return $columns;
282 }
283 break;
284 }
285 }
286
287 /** Implementation of hook_widget **/
288
289 function video_cck_widget($op, &$node, $field, &$node_field) {
290 if (module_hook('emfield', 'emfield_widget')) {
291 return emfield_emfield_widget($op, $node, $field, $node_field, 'video_cck');
292 }
293 }
294
295 function video_cck_embed_form($field, $item, $formatter, $node, $options = array()) {
296 $embed = $item['value'];
297 $width = $options['width'] ? $options['width'] : $field['widget']['video_width'];
298 $height = $options['height'] ? $options['height'] : $field['widget']['video_height'];
299 $autoplay = $options['autoplay'] ? $options['autoplay'] : $field['widget']['video_autoplay'];
300 $text = module_invoke('emfield', 'include_invoke', 'video_cck', $item['provider'], 'video', $embed, $width, $height, $field, $item, $autoplay);
301 $form = array();
302 $form['video_cck_embed'] = array(
303 '#type' => 'textarea',
304 '#title' => t('Embed Code'),
305 '#description' => t('To embed this video on your own site, simply copy and paste the html code from this text area.'),
306 '#default_value' => $text,
307 );
308 return $form;
309 }
310
311 /**
312 * providers may supply an enclosure for rss feeds. this expects something in a file format, so would be an object
313 * in the format of $file->filepath, $file->filesize, and $file->filemime.
314 * calls the providers hook video_cck_PROVIDER_rss($item, $teaser)
315 */
316 function video_cck_emfield_rss($node, $items = array(), $teaser = NULL) {
317 $rss_data = array();
318 foreach ($items as $item) {
319 // note only the first $item will get an RSS enclosure, other items may have media: data in the feed however
320 if ($item['value'] && $item['provider']) {
321 $rss_data[] = module_invoke('emfield', 'include_invoke', 'video_cck', $item['provider'], 'rss', $item, $teaser);
322 }
323 }
324 return $rss_data;
325 }
326
327 function theme_video_cck_video_embed($field, $item, $formatter, $node, $options = array()) {
328 /*
329 Note you can use this in node.tpl.php, substituting the proper field type:
330 $field_type = 'field_video';
331 $system_types = _content_type_info();
332 $field = $system_types['fields'][$field_type];
333 $field['widget'] = $system_types['content types'][$node->type]['fields'][$field_type]['widget'];
334 print theme('video_cck_video_embed', $field, $node->{$field_type}[0], 'video_cck_embed', $node);
335
336 or you can set $field to NULL and just use the options array
337 */
338 if ($item['value'] && $item['provider']) {
339 $output = drupal_get_form('video_cck_embed_form', $field, $item, $formatter, $node, $options);
340 }
341 return $output;
342 }
343
344 /**
345 * This will return a provided thumbnail image for a video.
346 *
347 * @param $field
348 * This is the field providing settings for the video thumbnail.
349 * @param $item
350 * This is the data returned by the field. It requires at the least to be an array with 'value' and 'provider'.
351 * $item['value'] will be the video code, and $item['provider'] will be the provider, such as youtube.
352 * @param $formatter
353 * This is the formatter for the view. This will nearly always be video_thumbnail.
354 * @param $node
355 * This is the node object containing the field.
356 * @param $no_link
357 * optional. if FALSE, then we provide a link to the node. (In retrospect, this should have been $link, defaulting to TRUE. TODO: fix? problem though is that this goes deeper up the tree.)
358 * @param $options
359 * optional array. this is to pass optional overrides. currently:
360 * $options['width'] and $options['height'], if provided, will override any field settings for the thumbnail w/h.
361 * $options['link_url'], if provided, will cause the thumbnail link to go to another URL other than node/nid. $no_link must be FALSE.
362 * $options['link_title'], if provided, will set the title of the link when no image is provided. otherwise, it defaults to 'See video'.
363 * $options['image_title'], if provided, will set the title attribute of the href link, defaulting to $options['link_title'].
364 * $options['image_alt'], if provided, will set the alt attribute of the href link, defaulting to $options['link_title'].
365 * $options['thumbnail_url'], if provided, will completely override the thumbnail image entirely.
366 */
367 function theme_video_cck_video_thumbnail($field, $item, $formatter, $node, $no_link = FALSE, $options = array()) {
368 // Sometime in the past, we added the $no_link argument before $options.
369 // However, emfield.module attempts to call this w/o $no_link at line 341.
370 if (is_array($no_link) && empty($options)) {
371 $options = $no_link;
372 }
373 if (is_array($no_link)) {
374 $no_link = FALSE;
375 }
376 if ($item['value'] && $item['provider']) {
377 // if we've set $options['thumbnail_url'], then we'll just use that.
378 // otherwise, if we have emthumb installed, then give it a chance to override our thumbnail
379 $thumbnail_url = $options['thumbnail_url'] ? $options['thumbnail_url'] : module_invoke('emthumb', 'thumbnail_url', $item);
380
381 // if we don't have a custom thumbnail, then see if the provider gives us a thumbnail
382 $thumbnail_url = $thumbnail_url ? $thumbnail_url : module_invoke('emfield', 'include_invoke', 'video_cck', $item['provider'], 'thumbnail', $field, $item, $formatter, $node, $width, $height, $options);
383
384 // if we still don't have a thumbnail, then apply a default thumbnail, if it exists
385 if (!$thumbnail_url) {
386 $default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('video_cck_default_thumbnail_path', NULL);
387 if ($default_thumbnail_url) {
388 $thumbnail_url = base_path() . $default_thumbnail_url;
389 }
390 }
391 }
392 else {
393 // seems to be an unknown video
394 // apply a default thumbnail, if it exists
395 if (!$thumbnail_url) {
396 $default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('video_cck_default_thumbnail_path', NULL);
397 if ($default_thumbnail_url) {
398 $thumbnail_url = base_path() . $default_thumbnail_url;
399 }
400 }
401 }
402
403 $link_url = isset($options['link_url']) ? $options['link_url'] : 'node/'. $node->nid;
404 $link_title = isset($options['link_title']) ? $options['link_title'] : t('See video');
405 $image_title = isset($options['image_title']) ? $options['image_title'] : $link_title;
406 $image_alt = isset($options['image_alt']) ? $options['image_alt'] : $link_title;
407
408 if ($thumbnail_url) {
409 $width = isset($options['width']) ? $options['width'] : NULL;
410 $width = isset($width) ? $width : ($field['widget']['thumbnail_width'] ? $field['widget']['thumbnail_width'] : variable_get('video_cck_default_thumbnail_width', VIDEO_CCK_DEFAULT_THUMBNAIL_WIDTH));
411 $height = isset($options['height']) ? $options['height'] : NULL;
412 $height = isset($height) ? $height : ($field['widget']['thumbnail_height'] ? $field['widget']['thumbnail_height'] : variable_get('video_cck_default_thumbnail_height', VIDEO_CCK_DEFAULT_THUMBNAIL_HEIGHT));
413 if ($no_link) { //thickbox requires the thumbnail returned without the link
414 $output = '<img src="'. $thumbnail_url .'" width="'. $width .'" height="'. $height .'" alt="'. $image_alt .'" title="'. $image_title .'" />';
415 }
416 else {
417 $output = l('<img src="'. $thumbnail_url .'" width="'. $width .'" height="'. $height .'" alt="'. $image_alt .'" title="'. $image_title .'" />', $link_url, array(), NULL, NULL, false, true);
418 }
419 }
420 else {
421 // if all else fails, then just print a 'see video' link.
422 if ($no_link) {
423 $output = ''; //thickbox won't work without a thumbnail
424 }
425 else {
426 $output = l($link_title, $link_url);
427 }
428 }
429
430 return $output;
431 }
432
433 function theme_video_cck_video_video($field, $item, $formatter, $node, $options = array()) {
434 if ($item['value'] && $item['provider']) {
435 $embed = $item['value'];
436 $width = isset($options['width']) ? $options['width'] : (isset($field['widget']['video_width']) ? $field['widget']['video_width'] : variable_get('video_cck_default_video_width', VIDEO_CCK_DEFAULT_VIDEO_WIDTH));
437 $height = isset($options['height']) ? $options['height'] : (isset($field['widget']['video_height']) ? $field['widget']['video_height'] : variable_get('video_cck_default_video_height', VIDEO_CCK_DEFAULT_VIDEO_HEIGHT));
438 $autoplay = isset($options['autoplay']) ? $options['autoplay'] : $field['widget']['video_autoplay'];
439 $output = module_invoke('emfield', 'include_invoke', 'video_cck', $item['provider'], 'video', $embed, $width, $height, $field, $item, $autoplay, $options);
440 }
441 return $output;
442 }
443
444 function theme_video_cck_default($field, $item, $formatter, $node, $options = array()) {
445 return theme('video_cck_video_video', $field, $item, $formatter, $node, $options);
446 }
447
448 function theme_video_cck_video_preview($field, $item, $formatter, $node, $options = array()) {
449 if ($item['value'] && $item['provider']) {
450 $embed = $item['value'];
451 $width = isset($options['width']) ? $options['width'] : (isset($field['widget']['preview_width']) ? $field['widget']['preview_width'] : variable_get('video_cck_default_preview_width', VIDEO_CCK_DEFAULT_PREVIEW_WIDTH));
452 $height = isset($options['height']) ? $options['height'] : (isset($field['widget']['preview_height']) ? $field['widget']['preview_height'] : variable_get('video_cck_default_preview_height', VIDEO_CCK_DEFAULT_PREVIEW_HEIGHT));
453 $autoplay = isset($options['autoplay']) ? $options['autoplay'] : $field['widget']['preview_autoplay'];
454 $output = module_invoke('emfield', 'include_invoke', 'video_cck', $item['provider'], 'preview', $embed, $width, $height, $field, $item, $autoplay, $options);
455 }
456 return $output;
457 }
458
459 function theme_video_cck_thickbox($field, $item, $formatter, $node, $options = array()) {
460 $thumbnail = theme('video_cck_video_thumbnail', $field, $item, 'video_thumbnail', $node, true, $options);
461
462 $width = isset($options['width']) ? $options['width'] : (isset($field['widget']['video_width']) ? $field['widget']['video_width'] : variable_get('video_cck_default_video_width', VIDEO_CCK_DEFAULT_VIDEO_WIDTH));
463 $height = isset($options['height']) ? $options['height'] : (isset($field['widget']['video_height']) ? $field['widget']['video_height'] : variable_get('video_cck_default_video_height', VIDEO_CCK_DEFAULT_VIDEO_HEIGHT));
464 $field_name = isset($options['field_name']) ? $options['field_name'] : $field['field_name'];
465 $type_name = isset($options['type_name']) ? $options['type_name'] : $field['type_name'];
466 $title = isset($options['title']) ? $options['title'] : $node->title;
467
468 $destination = 'video-cck/thickbox/'. $node->nid .'/'. $width .'/'. $height .'/'. $field_name;
469
470 $output = l($thumbnail, $destination, array('title' => $title, 'class' => 'thickbox', 'rel' => $type_name), NULL, NULL, FALSE, TRUE);
471 return $output;
472 }
473
474 function video_cck_handler_arg_provider($op, &$query, $argtype, $arg = '') {
475 return _emfield_handler_arg_provider($op, $query, $argtype, $arg, 'video_cck');
476 }
477
478 function video_cck_menu($may_cache) {
479 $items = array();
480 if (module_exists('thickbox')) {
481 if ($may_cache) {
482 $items[] = array(
483 'path' => 'video-cck/thickbox',
484 'callback' => 'video_cck_thickbox',
485 'access' => user_access('access content'),
486 'type' => MENU_CALLBACK,
487 );
488 }
489 }
490 return $items;
491 }
492
493 function video_cck_thickbox($nid, $width, $height, $field_name) {
494 $field = array();
495 $field['widget']['video_width'] = $width;
496 $field['widget']['video_height'] = $height;
497 $field['widget']['video_autoplay'] = 1;
498 $field['field_name'] = $field_name;
499 $node = node_load($nid);
500 $items = $node->$field_name;
501 $item = $items[0];
502 print theme('video_cck_video_video', $field, $item, 'video_video', $node);
503 }

  ViewVC Help
Powered by ViewVC 1.1.2