5f67af59a0fa8fb83cbda397bf5ab6897749de43
[yaffs-website] / web / core / modules / forum / forum.views.inc
1 <?php
2
3 /**
4  * @file
5  * Provide views data for forum.module.
6  */
7
8 /**
9  * Implements hook_views_data().
10  */
11 function forum_views_data() {
12
13   $data['forum_index']['table']['group'] = t('Forum');
14   $data['forum_index']['table']['base'] = [
15     'field' => 'nid',
16     'title' => t('Forum content'),
17     'access query tag' => 'node_access',
18   ];
19
20   $data['forum_index']['nid'] = [
21     'title' => t('Nid'),
22     '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       'base' => 'node',
37       'base field' => 'nid',
38       'label' => t('Node'),
39     ],
40   ];
41
42   $data['forum_index']['title'] = [
43     'title' => t('Title'),
44     'help' => t('The content title.'),
45     'field' => [
46       'id' => 'standard',
47       '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     'title' => t('Has taxonomy term ID'),
62     'help' => t('Display content if it has the selected taxonomy terms.'),
63     'argument' => [
64       'id' => 'taxonomy_index_tid',
65       'name table' => 'taxonomy_term_data',
66       'name field' => 'name',
67       'empty field name' => t('Uncategorized'),
68       'numeric' => TRUE,
69       'skip base' => 'taxonomy_term_data',
70     ],
71     'field' => [
72       'id' => 'numeric',
73     ],
74     'filter' => [
75       'title' => t('Has taxonomy term'),
76       'id' => 'taxonomy_index_tid',
77       'hierarchy table' => 'taxonomy_term_hierarchy',
78       'numeric' => TRUE,
79       'skip base' => 'taxonomy_term_data',
80       'allow empty' => TRUE,
81     ],
82     'relationship' => [
83       'base' => 'taxonomy_term',
84       'base field' => 'tid',
85       'label' => t('Term'),
86     ],
87   ];
88
89   $data['forum_index']['created'] = [
90     'title' => t('Post date'),
91     '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     'title' => t('Sticky'),
105     'help' => t('Whether or not the content is sticky.'),
106     'field' => [
107       'id' => 'boolean',
108       'click sortable' => TRUE,
109       'output formats' => [
110         'sticky' => [t('Sticky'), t('Not sticky')],
111       ],
112     ],
113     'filter' => [
114       'id' => 'boolean',
115       'label' => t('Sticky'),
116       'type' => 'yes-no',
117     ],
118     'sort' => [
119       'id' => 'standard',
120       '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     'title' => t('Last comment time'),
126     '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     'title' => t('Comment count'),
140     '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   return $data;
156 }