Projet

Général

Profil

Paste
Télécharger (4,58 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / link / views / link.views.inc @ 39a181a4

1
<?php
2

    
3
// @codingStandardsIgnoreFile
4

    
5
/**
6
 * @file
7
 * Contains functions handling views integration.
8
 */
9

    
10
/**
11
 * Implementation of hook_views_handlers().
12
 */
13
/*function link_views_handlers() {
14
  return array(
15
    'info' => array(
16
      'path' => drupal_get_path('module', 'link') .'/views',
17
    ),
18
    'handlers' => array(
19
      'link_views_handler_argument_target' => array(
20
        'parent' => 'views_handler_argument',
21
      ),
22
      'link_views_handler_filter_protocol' => array(
23
        'parent' => 'views_handler_filter_string',
24
      ),
25
    ),
26
  );
27
}*/
28

    
29
/**
30
 * Return CCK Views data for the link_field_settings($op == 'views data').
31
 *
32
 * @TODO: Is there some way to tell views I have formatters for it?
33
 */
34
/*function link_views_content_field_data($field) {
35
  // Build the automatic views data provided for us by CCK.
36
  // This creates all the information necessary for the "url" field.
37
  $data = content_views_field_views_data($field);
38

    
39
  $db_info = content_database_info($field);
40
  $table_alias = content_views_tablename($field);
41
  $field_types = _content_field_types();
42

    
43
  // Tweak the automatic views data for the link "url" field.
44
  // Set the filter title to "@label URL"
45
  $data[$table_alias][$field['field_name'] .'_url']['filter']['title'] = t('@label URL', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']);
46
  // Remove the argument handling for URLs.
47
  unset($data[$table_alias][$field['field_name'] .'_url']['argument']);
48

    
49
  // Build out additional views data for the link "title" field.
50
  $data[$table_alias][$field['field_name'] .'_title'] = array(
51
    'group' => t('Content'),
52
    'title' => t('@label title', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')',
53
    'help' =>  $data[$table_alias][$field['field_name'] .'_url']['help'],
54
    'argument' => array(
55
      'field' => $db_info['columns']['title']['column'],
56
      'tablename' => $db_info['table'],
57
      'handler' => 'content_handler_argument_string',
58
      'click sortable' => TRUE,
59
      'name field' => '', // TODO, mimic content.views.inc :)
60
      'content_field_name' => $field['field_name'],
61
      'allow_empty' => TRUE,
62
    ),
63
    'filter' => array(
64
      'field' => $db_info['columns']['title']['column'],
65
      'title' => t('@label title', array('@label' => t($field_types[$field['type']]['label']))),
66
      'tablename' => $db_info['table'],
67
      'handler' => 'content_handler_filter_string',
68
      'additional fields' => array(),
69
      'content_field_name' => $field['field_name'],
70
      'allow_empty' => TRUE,
71
    ),
72
    'sort' => array(
73
      'field' => $db_info['columns']['title']['column'],
74
      'tablename' => $db_info['table'],
75
      'handler' => 'content_handler_sort',
76
      'content_field_name' => $field['field_name'],
77
      'allow_empty' => TRUE,
78
    ),
79
  );
80

    
81
  // Build out additional Views filter for the link "protocol" pseudo field.
82
  // TODO: Add a protocol argument.
83
  $data[$table_alias][$field['field_name'] .'_protocol'] = array(
84
    'group' => t('Content'),
85
    'title' => t('@label protocol', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')',
86
    'help' =>  $data[$table_alias][$field['field_name'] .'_url']['help'],
87
    'filter' => array(
88
      'field' => $db_info['columns']['url']['column'],
89
      'title' => t('@label protocol', array('@label' => t($field_types[$field['type']]['label']))),
90
      'tablename' => $db_info['table'],
91
      'handler' => 'link_views_handler_filter_protocol',
92
      'additional fields' => array(),
93
      'content_field_name' => $field['field_name'],
94
      'allow_empty' => TRUE,
95
    ),
96
  );
97

    
98
  // Build out additional Views argument for the link "target" pseudo field.
99
  // TODO: Add a target filter.
100
  $data[$table_alias][$field['field_name'] .'_target'] = array(
101
    'group' => t('Content'),
102
    'title' => t('@label target', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')',
103
    'help' =>  $data[$table_alias][$field['field_name'] .'_url']['help'],
104
    'argument' => array(
105
      'field' => $db_info['columns']['attributes']['column'],
106
      'title' => t('@label target', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')',
107
      'tablename' => $db_info['table'],
108
      'handler' => 'link_views_handler_argument_target',
109
      'additional fields' => array(),
110
      'content_field_name' => $field['field_name'],
111
      'allow_empty' => TRUE,
112
    ),
113
  );
114

    
115
  return $data;
116
}*/