Project

General

Profile

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

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

1
<?php
2

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

    
10
/**
11
 * Implements hook_views_data().
12
 */
13
function print_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_node_conf']['table']['group'] = t('Printer-friendly version');
18
  $data['print_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_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_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_node_conf fields.
38
  $data['print_node_conf']['link'] = array(
39
    'title' => t('Web: Show link'),
40
    'help' => t('Whether to show the printer-friendly 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_node_conf']['comments'] = array(
55
    'title' => t('Web: Show link in individual comments'),
56
    'help' => t('Whether to show the printer-friendly 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_node_conf']['url_list'] = array(
71
    'title' => t('Web: 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

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

    
117
  return $data;
118
}