| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @file 5 * video_handler_field_data.inc 6 * 7 * Provides a handler for displaying thumbnails within the serialized data column. 8 */ 9 class video_views_handler_field_data extends content_handler_field { 10 11 function render($values) { 12 $values = drupal_clone($values); // Prevent affecting the original. 13 $data = unserialize($values->{$this->field_alias}); 14 $filepath = $data['video_thumb']; 15 16 // We're down to a single node here, so we can retrieve the actual field 17 // definition for the node type being considered. 18 $field = content_fields($this->content_field['field_name'], $values->{$this->aliases['type']}); 19 $options = $this->options; 20 $db_info = content_database_info($field); 21 22 // Build a pseudo-node from the retrieved values. 23 $node = drupal_clone($values); 24 $node->type = $values->{$this->aliases['type']}; 25 $node->nid = $values->{$this->aliases['nid']}; 26 $node->vid = $values->{$this->aliases['vid']}; 27 // Some formatters need to behave differently depending on the build_mode 28 // (for instance: preview), so we provide one. 29 $node->build_mode = NODE_BUILD_NORMAL; 30 31 $item = array(); 32 foreach ($db_info['columns'] as $column => $attributes) { 33 $item[$column] = $values->{$this->aliases[$attributes['column']]}; 34 } 35 36 $item['#delta'] = $field['multiple'] ? $values->{$this->aliases['delta']} : 0; 37 //added for thumbnails this should work. 38 $file = pathinfo($filepath); 39 $item['filepath'] = $filepath; 40 $item['filename'] = $file['basename']; 41 $item['filemime'] = file_get_mimetype($file['basename']); 42 $item['filesize'] = is_readable($filepath) ? filesize($filepath) : 0; 43 44 // Render items. 45 $formatter_name = $options['format']; 46 if ($formatter = _content_get_formatter($formatter_name, $field['type'])) { 47 if (content_handle('formatter', 'multiple values', $formatter) == CONTENT_HANDLE_CORE) { 48 // Single-value formatter. 49 $output = content_format($field, $item, $formatter_name, $node); 50 } 51 else { 52 // Multiple values formatter - we actually have only one value to display. 53 $output = content_format($field, array($item), $formatter_name, $node); 54 } 55 return $this->render_link($output, $values); 56 } 57 return ''; 58 } 59 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |