diff options
author | glen201 <glen201@527446.no-reply.drupal.org> | 2009-07-31 02:01:53 +0000 |
---|---|---|
committer | glen201 <glen201@527446.no-reply.drupal.org> | 2009-07-31 02:01:53 +0000 |
commit | b66f50d2ce11d0cc8bb53af94ad86278d3fe8e51 (patch) | |
tree | 0a9b459d44a0d2729c479d5393e87cd94cb785f2 /includes/video_views_handler_field_download.inc | |
parent | 2524eecbeef2c8b3c0d80a5ffcde2604da50e30c (diff) | |
download | video-b66f50d2ce11d0cc8bb53af94ad86278d3fe8e51.tar.gz video-b66f50d2ce11d0cc8bb53af94ad86278d3fe8e51.tar.bz2 |
#486064: by RobertOak "no video fields in views" Fixed, added Views 2 support
.MPEG/MPG defaulted to play with Windows Media
Diffstat (limited to 'includes/video_views_handler_field_download.inc')
-rw-r--r-- | includes/video_views_handler_field_download.inc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/includes/video_views_handler_field_download.inc b/includes/video_views_handler_field_download.inc new file mode 100644 index 0000000..c01333e --- /dev/null +++ b/includes/video_views_handler_field_download.inc @@ -0,0 +1,37 @@ +<?php +//$Id$ +/** +* Implementation of hook_views_tables +* +* @return +* array - Enables support in the video module for views integration + * @author Glen Marianko Twitter@demoforum <glenm at demoforum dot com> + * @todo +**/ + +/** + * Field handler to display the play length of the video. + * + * @ingroup views_field_handlers + */ +class video_views_handler_field_download extends views_handler_field { + /** + * Render field output to the browser. + */ + function render($values) { + return _video_views_handler_field_download($values); + } +} +/** +* Handler to to return the correct download link for the video in a field +**/ +function _video_views_handler_field_download($values) { + /* $str = NULL; + foreach($values as $key => $value) { + $str .= $key .'<br>'; + } + return $str; */ + if($values->node_type && $values->node_type != 'video') return NULL; + return l(t('Download'), "node/$values->nid/download", array()); +} + |