Project

General

Profile

Paste
Download (4.36 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / print / print_pdf / print_pdf.views.inc @ 76bdcd04

1
<?php
2

    
3
/**
4
 * @file
5
 * PDF Version Views integration.
6
 *
7
 * @ingroup print
8
 */
9

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

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

    
37
  // print_pdf_node_conf fields.
38
  $data['print_pdf_node_conf']['link'] = array(
39
    'title' => t('PDF: Show link'),
40
    'help' => t('Whether to show the PDF version link.'),
41
    'field' => array(
42
      'handler' => 'views_handler_field_boolean',
43
      'click sortable' => TRUE,
44
    ),
45
    'filter' => array(
46
      'handler' => 'views_handler_filter_boolean_operator',
47
      'label' => t('Active'),
48
      'type' => 'yes-no',
49
    ),
50
    'sort' => array(
51
      'handler' => 'views_handler_sort',
52
    ),
53
  );
54
  $data['print_pdf_node_conf']['comments'] = array(
55
    'title' => t('PDF: Show link in individual comments'),
56
    'help' => t('Whether to show the PDF version link in individual comments.'),
57
    'field' => array(
58
      'handler' => 'views_handler_field_boolean',
59
      'click sortable' => TRUE,
60
    ),
61
    'filter' => array(
62
      'handler' => 'views_handler_filter_boolean_operator',
63
      'label' => t('Active'),
64
      'type' => 'yes-no',
65
    ),
66
    'sort' => array(
67
      'handler' => 'views_handler_sort',
68
    ),
69
  );
70
  $data['print_pdf_node_conf']['url_list'] = array(
71
    'title' => t('PDF: Show Printer-friendly URLs list'),
72
    'help' => t('Whether to show the URL list.'),
73
    'field' => array(
74
      'handler' => 'views_handler_field_boolean',
75
      'click sortable' => TRUE,
76
    ),
77
    'filter' => array(
78
      'handler' => 'views_handler_filter_boolean_operator',
79
      'label' => t('Active'),
80
      'type' => 'yes-no',
81
    ),
82
    'sort' => array(
83
      'handler' => 'views_handler_sort',
84
    ),
85
  );
86
  $data['print_pdf_node_conf']['size'] = array(
87
    'title' => t('PDF: Paper size'),
88
    'help' => t('Configured PDF paper size'),
89
    'field' => array(
90
      'handler' => 'views_handler_field',
91
      'click sortable' => TRUE,
92
    ),
93
    'filter' => array(
94
      'handler' => 'views_handler_filter_string',
95
    ),
96
    'sort' => array(
97
      'handler' => 'views_handler_sort',
98
    ),
99
  );
100
  $data['print_pdf_node_conf']['orientation'] = array(
101
    'title' => t('PDF: Page orientation'),
102
    'help' => t('Configured PDF page orientation.'),
103
    'field' => array(
104
      'handler' => 'views_handler_field',
105
      'click sortable' => TRUE,
106
    ),
107
    'filter' => array(
108
      'handler' => 'views_handler_filter_string',
109
    ),
110
    'sort' => array(
111
      'handler' => 'views_handler_sort',
112
    ),
113
  );
114

    
115
  // print_pdf_page_counter fields.
116
  $data['print_pdf_page_counter']['totalcount'] = array(
117
    'title' => t('PDF: Number of page accesses'),
118
    'help' => t('Counter of accesses to the PDF version for this node.'),
119
    'field' => array(
120
      'handler' => 'views_handler_field_numeric',
121
      'click sortable' => TRUE,
122
    ),
123
    'sort' => array(
124
      'handler' => 'views_handler_sort',
125
    ),
126
    'filter' => array(
127
      'handler' => 'views_handler_filter_numeric',
128
    ),
129
  );
130
  $data['print_pdf_page_counter']['timestamp'] = array(
131
    'title' => t('PDF: Last access'),
132
    'help' => t("The date of the last access to the node's PDF version."),
133
    'field' => array(
134
      'handler' => 'views_handler_field_date',
135
      'click sortable' => TRUE,
136
    ),
137
    'sort' => array(
138
      'handler' => 'views_handler_sort_date',
139
    ),
140
    'filter' => array(
141
      'handler' => 'views_handler_filter_date',
142
    ),
143
  );
144

    
145
  return $data;
146
}