| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @file 5 * Provide views data for video.module. 6 */ 7 module_load_include('inc', 'content', '/includes/views/content.views'); 8 9 /** 10 * Implementation of hook_views_handlers(). 11 */ 12 function video_views_handlers() { 13 return array( 14 'info' => array( 15 'path' => drupal_get_path('module', 'video') . '/views', 16 ), 17 'handlers' => array( 18 // field handlers 19 'video_views_handler_field_data' => array( 20 'parent' => 'content_handler_field', 21 ), 22 ), 23 ); 24 } 25 26 /** 27 * Implementation of hook_views_data() 28 */ 29 function video_views_data() { 30 $data = array(); 31 $data['video']['table']['group'] = t('Video'); 32 $widgets = array('videoftp_widget', 'uploadfield_widget'); 33 foreach (content_fields () as $field) { 34 if ($field['module'] == 'filefield' && isset($field['widget']['type']) && in_array($field['widget']['type'], $widgets)) { 35 $views_data = content_views_field_views_data($field); 36 $table_alias = content_views_tablename($field); 37 $db_info = content_database_info($field); 38 39 $title = t('@label (!name) thumbnail', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])); 40 $types = array(); 41 foreach (content_types () as $type) { 42 if (isset($type['fields'][$field['field_name']])) { 43 // TODO : run check_plain here instead of on the imploded string below ? 44 $types[] = $type['name']; 45 } 46 } 47 48 $additional_fields = array(); 49 foreach ($db_info['columns'] as $column => $attributes) { 50 // Select explicitly enabled field columns. 51 if (!empty($attributes['views'])) { 52 $db_columns[$column] = $attributes; 53 } 54 // Ensure all columns are retrieved. 55 $additional_fields[$attributes['column']] = $attributes['column']; 56 } 57 58 $data[$table_alias][$field['field_name'] . '_thumbnail'] = array( 59 'group' => t('Video'), 60 'title' => $title, 61 // 'help' => t($field_types[$field['type']]['label']) .' - '. t('Appears in: @types', array('@types' => implode(', ', $types))), 62 // #931616 63 'help' => t('Appears in: @types', array('@types' => implode(', ', $types))), 64 ); 65 $data[$table_alias][$field['field_name'] . '_thumbnail']['field'] = array( 66 'title' => $title, 67 'field' => $db_info['columns']['data']['column'], 68 'table' => $db_info['table'], 69 'handler' => 'video_views_handler_field_data', 70 'click sortable' => FALSE, 71 'content_field_name' => $field['field_name'], 72 'additional fields' => $additional_fields, 73 'access callback' => 'content_access', 74 'access arguments' => array('view', $field), 75 ); 76 } 77 } 78 return $data; 79 }
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 |