6ad9e68ce41761b139b4f4fb86e36427c87046bb
[yaffs-website] / web / core / modules / dblog / dblog.views.inc
1 <?php
2
3 /**
4  * @file
5  * Provide views data for dblog.module.
6  */
7
8 /**
9  * Implements hook_views_data().
10  */
11 function dblog_views_data() {
12   $data = [];
13
14   $data['watchdog']['table']['group'] = t('Watchdog');
15   $data['watchdog']['table']['wizard_id'] = 'watchdog';
16
17   $data['watchdog']['table']['base'] = [
18     'field' => 'wid',
19     'title' => t('Log entries'),
20     'help' => t('Contains a list of log entries.'),
21   ];
22
23   $data['watchdog']['wid'] = [
24     'title' => t('WID'),
25     'help' => t('Unique watchdog event ID.'),
26     'field' => [
27       'id' => 'standard',
28     ],
29     'filter' => [
30       'id' => 'numeric',
31     ],
32     'argument' => [
33       'id' => 'numeric',
34     ],
35     'sort' => [
36       'id' => 'standard',
37     ],
38   ];
39
40   $data['watchdog']['uid'] = [
41     'title' => t('UID'),
42     'help' => t('The user ID of the user on which the log entry was written.'),
43     'field' => [
44       'id' => 'standard',
45     ],
46     'filter' => [
47       'id' => 'numeric',
48     ],
49     'argument' => [
50       'id' => 'numeric',
51     ],
52     'relationship' => [
53       'title' => t('User'),
54       'help' => t('The user on which the log entry as written.'),
55       'base' => 'users_field_data',
56       'base field' => 'uid',
57       'id' => 'standard',
58     ],
59   ];
60
61   $data['watchdog']['type'] = [
62     'title' => t('Type'),
63     'help' => t('The type of the log entry, for example "user" or "page not found".'),
64     'field' => [
65       'id' => 'standard',
66     ],
67     'argument' => [
68       'id' => 'string',
69     ],
70     'filter' => [
71       'id' => 'dblog_types',
72     ],
73     'sort' => [
74       'id' => 'standard',
75     ],
76   ];
77
78   $data['watchdog']['message'] = [
79     'title' => t('Message'),
80     'help' => t('The actual message of the log entry.'),
81     'field' => [
82       'id' => 'dblog_message',
83     ],
84     'argument' => [
85       'id' => 'string',
86     ],
87     'filter' => [
88       'id' => 'string',
89     ],
90     'sort' => [
91       'id' => 'standard',
92     ],
93   ];
94
95   $data['watchdog']['variables'] = [
96     'title' => t('Variables'),
97     'help' => t('The variables of the log entry in a serialized format.'),
98     'field' => [
99       'id' => 'serialized',
100       'click sortable' => FALSE,
101     ],
102     'argument' => [
103       'id' => 'string',
104     ],
105     'filter' => [
106       'id' => 'string',
107     ],
108     'sort' => [
109       'id' => 'standard',
110     ],
111   ];
112
113   $data['watchdog']['severity'] = [
114     'title' => t('Severity level'),
115     'help' => t('The severity level of the event; ranges from 0 (Emergency) to 7 (Debug).'),
116     'field' => [
117       'id' => 'machine_name',
118       'options callback' => 'Drupal\dblog\Controller\DbLogController::getLogLevelClassMap',
119     ],
120     'filter' => [
121       'id' => 'in_operator',
122       'options callback' => 'Drupal\Core\Logger\RfcLogLevel::getLevels',
123     ],
124     'sort' => [
125       'id' => 'standard',
126     ],
127   ];
128
129   $data['watchdog']['link'] = [
130     'title' => t('Operations'),
131     'help' => t('Operation links for the event.'),
132     'field' => [
133       'id' => 'dblog_operations',
134     ],
135     'argument' => [
136       'id' => 'string',
137     ],
138     'filter' => [
139       'id' => 'string',
140     ],
141     'sort' => [
142       'id' => 'standard',
143     ],
144   ];
145
146   $data['watchdog']['location'] = [
147     'title' => t('Location'),
148     'help' => t('URL of the origin of the event.'),
149     'field' => [
150       'id' => 'standard',
151     ],
152     'argument' => [
153       'id' => 'string',
154     ],
155     'filter' => [
156       'id' => 'string',
157     ],
158     'sort' => [
159       'id' => 'standard',
160     ],
161   ];
162
163   $data['watchdog']['referer'] = [
164     'title' => t('Referer'),
165     'help' => t('URL of the previous page.'),
166     'field' => [
167       'id' => 'standard',
168     ],
169     'argument' => [
170       'id' => 'string',
171     ],
172     'filter' => [
173       'id' => 'string',
174     ],
175     'sort' => [
176       'id' => 'standard',
177     ],
178   ];
179
180   $data['watchdog']['hostname'] = [
181     'title' => t('Hostname'),
182     'help' => t('Hostname of the user who triggered the event.'),
183     'field' => [
184       'id' => 'standard',
185     ],
186     'argument' => [
187       'id' => 'string',
188     ],
189     'filter' => [
190       'id' => 'string',
191     ],
192     'sort' => [
193       'id' => 'standard',
194     ],
195   ];
196
197   $data['watchdog']['timestamp'] = [
198     'title' => t('Timestamp'),
199     'help' => t('Date when the event occurred.'),
200     'field' => [
201       'id' => 'date',
202     ],
203     'argument' => [
204       'id' => 'date',
205     ],
206     'filter' => [
207       'id' => 'date',
208     ],
209     'sort' => [
210       'id' => 'date',
211     ],
212   ];
213
214   return $data;
215 }