forum.views.inc 3.39 KB
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Provide views data for forum.module.
6 7 8 9 10 11 12 13
 */

/**
 * Implements hook_views_data().
 */
function forum_views_data() {

  $data['forum_index']['table']['group'] = t('Forum');
14
  $data['forum_index']['table']['base'] = [
15 16 17
    'field' => 'nid',
    'title' => t('Forum content'),
    'access query tag' => 'node_access',
18
  ];
19

20
  $data['forum_index']['nid'] = [
21 22
    'title' => t('Nid'),
    'help' => t('The content ID of the forum index entry.'),
23
    'field' => [
24
      'id' => 'numeric',
25 26
    ],
    'filter' => [
27
      'id' => 'numeric',
28 29
    ],
    'argument' => [
30
      'id' => 'numeric',
31 32
    ],
    'sort' => [
33
      'id' => 'standard',
34 35
    ],
    'relationship' => [
36 37 38
      'base' => 'node',
      'base field' => 'nid',
      'label' => t('Node'),
39 40
    ],
  ];
41

42
  $data['forum_index']['title'] = [
43 44
    'title' => t('Title'),
    'help' => t('The content title.'),
45
    'field' => [
46 47
      'id' => 'standard',
      'link_to_node default' => TRUE,
48 49
    ],
    'sort' => [
50
      'id' => 'standard',
51 52
    ],
    'filter' => [
53
      'id' => 'string',
54 55
    ],
    'argument' => [
56
      'id' => 'string',
57 58
    ],
  ];
59

60
  $data['forum_index']['tid'] = [
61 62
    'title' => t('Has taxonomy term ID'),
    'help' => t('Display content if it has the selected taxonomy terms.'),
63
    'argument' => [
64 65 66 67 68 69
      'id' => 'taxonomy_index_tid',
      'name table' => 'taxonomy_term_data',
      'name field' => 'name',
      'empty field name' => t('Uncategorized'),
      'numeric' => TRUE,
      'skip base' => 'taxonomy_term_data',
70 71
    ],
    'field' => [
72
      'id' => 'numeric',
73 74
    ],
    'filter' => [
75 76
      'title' => t('Has taxonomy term'),
      'id' => 'taxonomy_index_tid',
77
      'hierarchy table' => 'taxonomy_term__parent',
78 79 80
      'numeric' => TRUE,
      'skip base' => 'taxonomy_term_data',
      'allow empty' => TRUE,
81 82
    ],
    'relationship' => [
83 84 85
      'base' => 'taxonomy_term',
      'base field' => 'tid',
      'label' => t('Term'),
86 87
    ],
  ];
88

89
  $data['forum_index']['created'] = [
90 91
    'title' => t('Post date'),
    'help' => t('The date the content was posted.'),
92
    'field' => [
93
      'id' => 'date',
94 95
    ],
    'sort' => [
96
      'id' => 'date',
97 98
    ],
    'filter' => [
99
      'id' => 'date',
100 101
    ],
  ];
102

103
  $data['forum_index']['sticky'] = [
104 105
    'title' => t('Sticky'),
    'help' => t('Whether or not the content is sticky.'),
106
    'field' => [
107 108
      'id' => 'boolean',
      'click sortable' => TRUE,
109 110 111 112 113
      'output formats' => [
        'sticky' => [t('Sticky'), t('Not sticky')],
      ],
    ],
    'filter' => [
114 115 116
      'id' => 'boolean',
      'label' => t('Sticky'),
      'type' => 'yes-no',
117 118
    ],
    'sort' => [
119 120
      'id' => 'standard',
      'help' => t('Whether or not the content is sticky. To list sticky content first, set this to descending.'),
121 122
    ],
  ];
123

124
  $data['forum_index']['last_comment_timestamp'] = [
125 126
    'title' => t('Last comment time'),
    'help' => t('Date and time of when the last comment was posted.'),
127
    'field' => [
128
      'id' => 'comment_last_timestamp',
129 130
    ],
    'sort' => [
131
      'id' => 'date',
132 133
    ],
    'filter' => [
134
      'id' => 'date',
135 136
    ],
  ];
137

138
  $data['forum_index']['comment_count'] = [
139 140
    'title' => t('Comment count'),
    'help' => t('The number of comments a node has.'),
141
    'field' => [
142
      'id' => 'numeric',
143 144
    ],
    'filter' => [
145
      'id' => 'numeric',
146 147
    ],
    'sort' => [
148
      'id' => 'standard',
149 150
    ],
    'argument' => [
151
      'id' => 'standard',
152 153
    ],
  ];
154 155 156

  return $data;
}