Projet

Général

Profil

Paste
Télécharger (3,64 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / print / print.views.inc @ 87dbc3bf

1
<?php
2

    
3
/**
4
 * @file
5
 * Printer-friendly version Views integration
6
 *
7
 * @ingroup print
8
 */
9

    
10

    
11
/**
12
 * Implements hook_views_data().
13
 */
14
function print_views_data() {
15
  // The 'group' index will be used as a prefix in the UI for any of this
16
  // table's fields, sort criteria, etc. so it's easy to tell where they came
17
  // from.
18
  $data['print_node_conf']['table']['group'] = t('Printer-friendly version');
19
  $data['print_page_counter']['table']['group'] = t('Printer-friendly version');
20

    
21
  // This table references the {node} table. The declaration below creates an
22
  // 'implicit' relationship to the node table, so that when 'node' is the base
23
  // table, the fields are automatically available.
24
  $data['print_node_conf']['table']['join']['node'] = array(
25
    // 'left_field' is the primary key in the referenced table.
26
    // 'field' is the foreign key in this table.
27
    'left_field' => 'nid',
28
    'field' => 'nid',
29
//    'type' => 'INNER',
30
  );
31
  $data['print_page_counter']['table']['join']['node'] = array(
32
    // 'left_field' is the primary key in the referenced table.
33
    // 'field' is the foreign key in this table.
34
    'left_field' => 'nid',
35
    'field' => 'path',
36
//    'type' => 'INNER',
37
    'handler' => 'print_join_page_counter',
38
  );
39

    
40
  // print_node_conf fields
41
  $data['print_node_conf']['link'] = array(
42
    'title' => t('Web: Show link'),
43
    'help' => t('Whether to show the printer-friendly version link.'),
44
    'field' => array(
45
      'handler' => 'views_handler_field_boolean',
46
      'click sortable' => TRUE,
47
    ),
48
    'filter' => array(
49
      'handler' => 'views_handler_filter_boolean_operator',
50
      'label' => t('Active'),
51
      'type' => 'yes-no',
52
    ),
53
    'sort' => array(
54
      'handler' => 'views_handler_sort',
55
    ),
56
  );
57
  $data['print_node_conf']['comments'] = array(
58
    'title' => t('Web: Show link in individual comments'),
59
    'help' => t('Whether to show the printer-friendly version link in individual comments.'),
60
    'field' => array(
61
      'handler' => 'views_handler_field_boolean',
62
      'click sortable' => TRUE,
63
    ),
64
    'filter' => array(
65
      'handler' => 'views_handler_filter_boolean_operator',
66
      'label' => t('Active'),
67
      'type' => 'yes-no',
68
    ),
69
    'sort' => array(
70
      'handler' => 'views_handler_sort',
71
    ),
72
  );
73
  $data['print_node_conf']['url_list'] = array(
74
    'title' => t('Web: Show Printer-friendly URLs list'),
75
    'help' => t('Whether to show the URL list.'),
76
    'field' => array(
77
      'handler' => 'views_handler_field_boolean',
78
      'click sortable' => TRUE,
79
    ),
80
    'filter' => array(
81
      'handler' => 'views_handler_filter_boolean_operator',
82
      'label' => t('Active'),
83
      'type' => 'yes-no',
84
    ),
85
    'sort' => array(
86
      'handler' => 'views_handler_sort',
87
    ),
88
  );
89

    
90

    
91
  // print_page_counter fields
92
  $data['print_page_counter']['totalcount'] = array(
93
    'title' => t('Web: Number of page accesses'),
94
    'help' => t('Counter of accesses to the printer-friendly version for this node.'),
95
    'field' => array(
96
      'handler' => 'views_handler_field_numeric',
97
      'click sortable' => TRUE,
98
    ),
99
    'sort' => array(
100
      'handler' => 'views_handler_sort',
101
    ),
102
    'filter' => array(
103
      'handler' => 'views_handler_filter_numeric',
104
    ),
105
  );
106
  $data['print_page_counter']['timestamp'] = array(
107
    'title' => t('Web: Last access'),
108
    'help' => t("The date of the last access to the node's printer-friendly version."),
109
    'field' => array(
110
      'handler' => 'views_handler_field_date',
111
      'click sortable' => TRUE,
112
    ),
113
    'sort' => array(
114
      'handler' => 'views_handler_sort_date',
115
    ),
116
    'filter' => array(
117
      'handler' => 'views_handler_filter_date',
118
    ),
119
  );
120

    
121
  return $data;
122
}