| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: link.views.inc,v 1.1.4.3 2010/06/14 15:59:35 jcfiala Exp $ 3 /** 4 * @file 5 * Contains functions handling views integration. 6 */ 7 8 /** 9 * Implementation of hook_views_handlers(). 10 */ 11 function link_views_handlers() { 12 return array( 13 'info' => array( 14 'path' => drupal_get_path('module', 'link') .'/views', 15 ), 16 'handlers' => array( 17 'link_views_handler_argument_target' => array( 18 'parent' => 'views_handler_argument', 19 ), 20 'link_views_handler_filter_protocol' => array( 21 'parent' => 'views_handler_filter_string', 22 ), 23 ), 24 ); 25 } 26 27 /** 28 * Return CCK Views data for the link_field_settings($op == 'views data'). 29 */ 30 function link_views_content_field_data($field) { 31 // Build the automatic views data provided for us by CCK. 32 // This creates all the information necessary for the "url" field. 33 $data = content_views_field_views_data($field); 34 35 $db_info = content_database_info($field); 36 $table_alias = content_views_tablename($field); 37 $field_types = _content_field_types(); 38 39 // Tweak the automatic views data for the link "url" field. 40 // Set the filter title to "@label URL" 41 $data[$table_alias][$field['field_name'] .'_url']['filter']['title'] = t('@label URL', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']); 42 // Remove the argument handling for URLs. 43 unset($data[$table_alias][$field['field_name'] .'_url']['argument']); 44 45 // Build out additional views data for the link "title" field. 46 $data[$table_alias][$field['field_name'] .'_title'] = array( 47 'group' => t('Content'), 48 'title' => t('@label title', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')', 49 'help' => $data[$table_alias][$field['field_name'] .'_url']['help'], 50 'argument' => array( 51 'field' => $db_info['columns']['title']['column'], 52 'tablename' => $db_info['table'], 53 'handler' => 'content_handler_argument_string', 54 'click sortable' => TRUE, 55 'name field' => '', // TODO, mimic content.views.inc :) 56 'content_field_name' => $field['field_name'], 57 'allow_empty' => TRUE, 58 ), 59 'filter' => array( 60 'field' => $db_info['columns']['title']['column'], 61 'title' => t('@label title', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']), 62 'tablename' => $db_info['table'], 63 'handler' => 'content_handler_filter_string', 64 'additional fields' => array(), 65 'content_field_name' => $field['field_name'], 66 'allow_empty' => TRUE, 67 ), 68 'sort' => array( 69 'field' => $db_info['columns']['title']['column'], 70 'tablename' => $db_info['table'], 71 'handler' => 'content_handler_sort', 72 'content_field_name' => $field['field_name'], 73 'allow_empty' => TRUE, 74 ), 75 ); 76 77 // Build out additional Views filter for the link "protocol" pseudo field. 78 $data[$table_alias][$field['field_name'] .'_protocol'] = array( 79 'group' => t('Content'), 80 'title' => t('@label protocol', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')', 81 'help' => $data[$table_alias][$field['field_name'] .'_url']['help'], 82 'filter' => array( 83 'field' => $db_info['columns']['url']['column'], 84 'title' => t('@label protocol', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']), 85 'tablename' => $db_info['table'], 86 'handler' => 'link_views_handler_filter_protocol', 87 'additional fields' => array(), 88 'content_field_name' => $field['field_name'], 89 'allow_empty' => TRUE, 90 ), 91 ); 92 93 // Build out additional Views argument for the link "target" pseudo field. 94 $data[$table_alias][$field['field_name'] .'_target'] = array( 95 'group' => t('Content'), 96 'title' => t('@label target', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')', 97 'help' => $data[$table_alias][$field['field_name'] .'_url']['help'], 98 'argument' => array( 99 'field' => $db_info['columns']['attributes']['column'], 100 'title' => t('@label target', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')', 101 'tablename' => $db_info['table'], 102 'handler' => 'link_views_handler_argument_target', 103 'additional fields' => array(), 104 'content_field_name' => $field['field_name'], 105 'allow_empty' => TRUE, 106 ), 107 ); 108 109 return $data; 110 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |