comment.views.inc 14.3 KB
Newer Older
merlinofchaos's avatar
merlinofchaos committed
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php

/**
 * @file
 * Provide views data and handlers for comment.module.
 *
 * @ingroup views_module_handlers
 */

/**
 * Implements hook_views_data().
 */
function comment_views_data() {
14
15
16

  // Define the base group of this table. Fields that don't have a group defined
  // will go into this field by default.
merlinofchaos's avatar
merlinofchaos committed
17
18
19
20
21
22
23
24
25
  $data['comment']['table']['group']  = t('Comment');

  $data['comment']['table']['base'] = array(
    'field' => 'cid',
    'title' => t('Comment'),
    'help' => t("Comments are responses to node content."),
    'access query tag' => 'comment_access',
  );
  $data['comment']['table']['entity type'] = 'comment';
26
  $data['comment']['table']['wizard_id'] = 'comment';
merlinofchaos's avatar
merlinofchaos committed
27
28
29
30
31

  $data['comment']['subject'] = array(
    'title' => t('Title'),
    'help' => t('The title of the comment.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
32
      'id' => 'comment',
merlinofchaos's avatar
merlinofchaos committed
33
34
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
35
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
36
37
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
38
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
39
40
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
41
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
42
43
44
45
46
47
48
    ),
  );

  $data['comment']['cid'] = array(
    'title' => t('ID'),
    'help' => t('The comment ID of the field'),
    'field' => array(
aspilicious's avatar
aspilicious committed
49
      'id' => 'comment',
merlinofchaos's avatar
merlinofchaos committed
50
51
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
52
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
53
54
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
55
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
56
57
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
58
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
59
60
61
62
63
64
65
    ),
  );

  $data['comment']['name'] = array(
    'title' => t('Author'),
    'help' => t("The name of the comment's author. Can be rendered as a link to the author's homepage."),
    'field' => array(
aspilicious's avatar
aspilicious committed
66
      'id' => 'comment_username',
merlinofchaos's avatar
merlinofchaos committed
67
68
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
69
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
70
71
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
72
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
73
74
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
75
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
76
77
78
79
80
81
82
    ),
  );

  $data['comment']['homepage'] = array(
    'title' => t("Author's website"),
    'help' => t("The website address of the comment's author. Can be rendered as a link. Will be empty if the author is a registered user."),
    'field' => array(
aspilicious's avatar
aspilicious committed
83
      'id' => 'url',
merlinofchaos's avatar
merlinofchaos committed
84
85
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
86
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
87
88
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
89
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
90
91
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
92
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
93
94
95
96
97
98
99
    ),
  );

  $data['comment']['hostname'] = array(
    'title' => t('Hostname'),
    'help' => t('Hostname of user that posted the comment.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
100
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
101
102
     ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
103
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
104
105
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
106
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
107
108
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
109
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
110
111
112
113
    ),
  );

  $data['comment']['mail'] = array(
114
115
    'title' => t('E-mail'),
    'help' => t('E-mail of user that posted the comment. Will be empty if the author is a registered user.'),
merlinofchaos's avatar
merlinofchaos committed
116
    'field' => array(
aspilicious's avatar
aspilicious committed
117
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
118
119
     ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
120
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
121
122
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
123
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
124
125
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
126
      'id' => 'string',
merlinofchaos's avatar
merlinofchaos committed
127
128
129
130
131
132
133
    ),
  );

  $data['comment']['created'] = array(
    'title' => t('Post date'),
    'help' => t('Date and time of when the comment was created.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
134
      'id' => 'date',
merlinofchaos's avatar
merlinofchaos committed
135
136
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
137
      'id' => 'date',
merlinofchaos's avatar
merlinofchaos committed
138
139
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
140
      'id' => 'date',
merlinofchaos's avatar
merlinofchaos committed
141
142
143
    ),
  );

144
145
  if (module_exists('language')) {
    $data['comment']['langcode'] = array(
146
147
148
      'title' => t('Language'),
      'help' => t('The language the comment is in.'),
      'field' => array(
149
        'id' => 'language',
150
151
      ),
      'filter' => array(
152
        'id' => 'language',
153
154
      ),
      'argument' => array(
155
        'id' => 'language',
156
157
      ),
      'sort' => array(
aspilicious's avatar
aspilicious committed
158
        'id' => 'standard',
159
160
161
162
      ),
    );
  }

merlinofchaos's avatar
merlinofchaos committed
163
164
165
166
  $data['comment']['changed'] = array(
    'title' => t('Updated date'),
    'help' => t('Date and time of when the comment was last updated.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
167
      'id' => 'date',
merlinofchaos's avatar
merlinofchaos committed
168
169
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
170
      'id' => 'date',
merlinofchaos's avatar
merlinofchaos committed
171
172
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
173
      'id' => 'date',
merlinofchaos's avatar
merlinofchaos committed
174
175
176
177
178
179
180
181
    ),
  );

  $data['comment']['changed_fulldata'] = array(
    'title' => t('Created date'),
    'help' => t('Date in the form of CCYYMMDD.'),
    'argument' => array(
      'field' => 'changed',
182
      'id' => 'date_fulldate',
merlinofchaos's avatar
merlinofchaos committed
183
184
185
186
187
188
189
190
    ),
  );

  $data['comment']['changed_year_month'] = array(
    'title' => t('Created year + month'),
    'help' => t('Date in the form of YYYYMM.'),
    'argument' => array(
      'field' => 'changed',
191
      'id' => 'date_year_month',
merlinofchaos's avatar
merlinofchaos committed
192
193
194
195
196
197
198
199
    ),
  );

  $data['comment']['changed_year'] = array(
    'title' => t('Created year'),
    'help' => t('Date in the form of YYYY.'),
    'argument' => array(
      'field' => 'changed',
200
      'id' => 'date_year',
merlinofchaos's avatar
merlinofchaos committed
201
202
203
204
205
206
207
208
    ),
  );

  $data['comment']['changed_month'] = array(
    'title' => t('Created month'),
    'help' => t('Date in the form of MM (01 - 12).'),
    'argument' => array(
      'field' => 'changed',
209
      'id' => 'date_month',
merlinofchaos's avatar
merlinofchaos committed
210
211
212
213
214
215
216
217
    ),
  );

  $data['comment']['changed_day'] = array(
    'title' => t('Created day'),
    'help' => t('Date in the form of DD (01 - 31).'),
    'argument' => array(
      'field' => 'changed',
218
      'id' => 'date_day',
merlinofchaos's avatar
merlinofchaos committed
219
220
221
222
223
224
225
226
    ),
  );

  $data['comment']['changed_week'] = array(
    'title' => t('Created week'),
    'help' => t('Date in the form of WW (01 - 53).'),
    'argument' => array(
      'field' => 'changed',
227
      'id' => 'date_week',
merlinofchaos's avatar
merlinofchaos committed
228
229
230
231
    ),
  );

  $data['comment']['status'] = array(
232
    'title' => t('Approved status'),
merlinofchaos's avatar
merlinofchaos committed
233
234
    'help' => t('Whether the comment is approved (or still in the moderation queue).'),
    'field' => array(
aspilicious's avatar
aspilicious committed
235
      'id' => 'boolean',
merlinofchaos's avatar
merlinofchaos committed
236
237
238
239
240
      'output formats' => array(
        'approved-not-approved' => array(t('Approved'), t('Not Approved')),
      ),
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
241
      'id' => 'boolean',
242
      'label' => t('Approved comment status'),
merlinofchaos's avatar
merlinofchaos committed
243
244
245
      'type' => 'yes-no',
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
246
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
247
248
249
250
251
    ),
  );

  $data['comment']['view_comment'] = array(
    'field' => array(
252
      'title' => t('Link to comment'),
merlinofchaos's avatar
merlinofchaos committed
253
      'help' => t('Provide a simple link to view the comment.'),
aspilicious's avatar
aspilicious committed
254
      'id' => 'comment_link',
merlinofchaos's avatar
merlinofchaos committed
255
256
257
258
259
    ),
  );

  $data['comment']['edit_comment'] = array(
    'field' => array(
260
      'title' => t('Link to edit comment'),
merlinofchaos's avatar
merlinofchaos committed
261
      'help' => t('Provide a simple link to edit the comment.'),
aspilicious's avatar
aspilicious committed
262
      'id' => 'comment_link_edit',
merlinofchaos's avatar
merlinofchaos committed
263
264
265
266
267
    ),
  );

  $data['comment']['delete_comment'] = array(
    'field' => array(
268
      'title' => t('Link to delete comment'),
merlinofchaos's avatar
merlinofchaos committed
269
      'help' => t('Provide a simple link to delete the comment.'),
aspilicious's avatar
aspilicious committed
270
      'id' => 'comment_link_delete',
merlinofchaos's avatar
merlinofchaos committed
271
272
273
274
275
    ),
  );

  $data['comment']['approve_comment'] = array(
    'field' => array(
276
      'title' => t('Link to approve comment'),
merlinofchaos's avatar
merlinofchaos committed
277
      'help' => t('Provide a simple link to approve the comment.'),
aspilicious's avatar
aspilicious committed
278
      'id' => 'comment_link_approve',
merlinofchaos's avatar
merlinofchaos committed
279
280
281
282
283
    ),
  );

  $data['comment']['replyto_comment'] = array(
    'field' => array(
284
      'title' => t('Link to reply-to comment'),
merlinofchaos's avatar
merlinofchaos committed
285
      'help' => t('Provide a simple link to reply to the comment.'),
aspilicious's avatar
aspilicious committed
286
      'id' => 'comment_link_reply',
merlinofchaos's avatar
merlinofchaos committed
287
288
289
290
291
292
293
    ),
  );

  $data['comment']['thread'] = array(
    'field' => array(
      'title' => t('Depth'),
      'help' => t('Display the depth of the comment if it is threaded.'),
aspilicious's avatar
aspilicious committed
294
      'id' => 'comment_depth',
merlinofchaos's avatar
merlinofchaos committed
295
296
297
298
    ),
    'sort' => array(
      'title' => t('Thread'),
      'help' => t('Sort by the threaded order. This will keep child comments together with their parents.'),
aspilicious's avatar
aspilicious committed
299
      'id' => 'comment_thread',
merlinofchaos's avatar
merlinofchaos committed
300
301
302
303
304
305
306
307
308
309
310
    ),
  );

  $data['comment']['nid'] = array(
    'title' => t('Nid'),
    'help' => t('The node ID to which the comment is a reply to.'),
    'relationship' => array(
      'title' => t('Content'),
      'help' => t('The content to which the comment is a reply to.'),
      'base' => 'node',
      'base field' => 'nid',
aspilicious's avatar
aspilicious committed
311
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
312
313
314
      'label' => t('Content'),
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
315
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
316
317
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
318
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
319
320
    ),
    'field' => array(
aspilicious's avatar
aspilicious committed
321
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
322
323
324
325
326
327
328
329
330
331
332
    ),
  );

  $data['comment']['uid'] = array(
    'title' => t('Author uid'),
    'help' => t('If you need more fields than the uid add the comment: author relationship'),
    'relationship' => array(
      'title' => t('Author'),
      'help' => t("The User ID of the comment's author."),
      'base' => 'users',
      'base field' => 'uid',
aspilicious's avatar
aspilicious committed
333
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
334
335
336
      'label' => t('author'),
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
337
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
338
339
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
340
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
341
342
    ),
    'field' => array(
aspilicious's avatar
aspilicious committed
343
      'id' => 'user',
merlinofchaos's avatar
merlinofchaos committed
344
345
346
347
348
349
350
    ),
  );

  $data['comment']['pid'] = array(
    'title' => t('Parent CID'),
    'help' => t('The Comment ID of the parent comment.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
351
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
352
353
354
355
356
357
    ),
    'relationship' => array(
      'title' => t('Parent comment'),
      'help' => t('The parent comment.'),
      'base' => 'comment',
      'base field' => 'cid',
aspilicious's avatar
aspilicious committed
358
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
359
360
361
362
      'label' => t('Parent comment'),
    ),
  );

363
  if (Drupal::moduleHandler()->moduleExists('content_translation')) {
364
365
366
367
    $data['comment']['translation_link'] = array(
      'title' => t('Translation link'),
      'help' => t('Provide a link to the translations overview for comments.'),
      'field' => array(
368
        'id' => 'content_translation_link',
369
370
371
372
      ),
    );
  }

373
374
  // Define the base group of this table. Fields that don't have a group defined
  // will go into this field by default.
merlinofchaos's avatar
merlinofchaos committed
375
376
  $data['node_comment_statistics']['table']['group']  = t('Content');

377
  // Explain how this table joins to others.
merlinofchaos's avatar
merlinofchaos committed
378
379
380
381
382
383
384
385
386
387
388
389
  $data['node_comment_statistics']['table']['join'] = array(
    'node' => array(
      'type' => 'INNER',
      'left_field' => 'nid',
      'field' => 'nid',
     ),
  );

  $data['node_comment_statistics']['last_comment_timestamp'] = array(
    'title' => t('Last comment time'),
    'help' => t('Date and time of when the last comment was posted.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
390
      'id' => 'comment_last_timestamp',
merlinofchaos's avatar
merlinofchaos committed
391
392
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
393
      'id' => 'date',
merlinofchaos's avatar
merlinofchaos committed
394
395
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
396
      'id' => 'date',
merlinofchaos's avatar
merlinofchaos committed
397
398
399
400
401
402
403
    ),
  );

  $data['node_comment_statistics']['last_comment_name'] = array(
    'title' => t("Last comment author"),
    'help' => t('The name of the author of the last posted comment.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
404
      'id' => 'comment_ncs_last_comment_name',
merlinofchaos's avatar
merlinofchaos committed
405
406
407
      'no group by' => TRUE,
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
408
      'id' => 'comment_ncs_last_comment_name',
merlinofchaos's avatar
merlinofchaos committed
409
410
411
412
413
414
415
416
      'no group by' => TRUE,
    ),
  );

  $data['node_comment_statistics']['comment_count'] = array(
    'title' => t('Comment count'),
    'help' => t('The number of comments a node has.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
417
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
418
419
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
420
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
421
422
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
423
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
424
425
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
426
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
427
428
429
430
431
432
433
    ),
  );

  $data['node_comment_statistics']['last_updated'] = array(
    'title' => t('Updated/commented date'),
    'help' => t('The most recent of last comment posted or node updated time.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
434
      'id' => 'comment_ncs_last_updated',
merlinofchaos's avatar
merlinofchaos committed
435
436
437
      'no group by' => TRUE,
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
438
      'id' => 'comment_ncs_last_updated',
merlinofchaos's avatar
merlinofchaos committed
439
440
441
      'no group by' => TRUE,
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
442
      'id' => 'comment_ncs_last_updated',
merlinofchaos's avatar
merlinofchaos committed
443
444
445
446
447
448
449
    ),
  );

  $data['node_comment_statistics']['cid'] = array(
    'title' => t('Last comment CID'),
    'help' => t('Display the last comment of a node'),
    'relationship' => array(
450
      'title' => t('Last comment'),
merlinofchaos's avatar
merlinofchaos committed
451
452
453
454
      'help' => t('The last comment of a node.'),
      'group' => t('Comment'),
      'base' => 'comment',
      'base field' => 'cid',
aspilicious's avatar
aspilicious committed
455
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
456
457
458
459
460
461
462
463
464
465
466
      'label' => t('Last Comment'),
    ),
  );

  $data['node_comment_statistics']['last_comment_uid'] = array(
    'title' => t('Last comment uid'),
    'help' => t('The User ID of the author of the last comment of a node.'),
    'relationship' => array(
      'title' => t('Last comment author'),
      'base' => 'users',
      'base field' => 'uid',
aspilicious's avatar
aspilicious committed
467
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
468
469
470
      'label' => t('Last comment author'),
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
471
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
472
473
    ),
    'argument' => array(
aspilicious's avatar
aspilicious committed
474
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
475
476
    ),
    'field' => array(
aspilicious's avatar
aspilicious committed
477
      'id' => 'numeric',
merlinofchaos's avatar
merlinofchaos committed
478
479
480
481
482
483
484
    ),
  );

  return $data;
}

/**
485
 * Implements hook_views_data_alter().
merlinofchaos's avatar
merlinofchaos committed
486
487
488
489
490
491
492
 */
function comment_views_data_alter(&$data) {
  // new comments
  $data['node']['new_comments'] = array(
    'title' => t('New comments'),
    'help' => t('The number of new comments on the node.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
493
      'id' => 'node_new_comments',
merlinofchaos's avatar
merlinofchaos committed
494
495
496
497
498
499
500
501
      'no group by' => TRUE,
    ),
  );

  $data['node']['comments_link'] = array(
    'field' => array(
      'title' => t('Add comment link'),
      'help' => t('Display the standard add comment link used on regular nodes, which will only display if the viewing user has access to add a comment.'),
aspilicious's avatar
aspilicious committed
502
      'id' => 'comment_node_link',
merlinofchaos's avatar
merlinofchaos committed
503
504
505
    ),
  );

506
  $data['node_field_data']['comment'] = array(
merlinofchaos's avatar
merlinofchaos committed
507
508
509
    'title' => t('Comment status'),
    'help' => t('Whether comments are enabled or disabled on the node.'),
    'field' => array(
aspilicious's avatar
aspilicious committed
510
      'id' => 'node_comment',
merlinofchaos's avatar
merlinofchaos committed
511
512
    ),
    'sort' => array(
aspilicious's avatar
aspilicious committed
513
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
514
515
    ),
    'filter' => array(
aspilicious's avatar
aspilicious committed
516
      'id' => 'node_comment',
merlinofchaos's avatar
merlinofchaos committed
517
518
519
    ),
  );

520
  $data['node_field_data']['uid_touch'] = array(
merlinofchaos's avatar
merlinofchaos committed
521
522
523
524
525
526
    'title' => t('User posted or commented'),
    'help' => t('Display nodes only if a user posted the node or commented on the node.'),
    'argument' => array(
      'field' => 'uid',
      'name table' => 'users',
      'name field' => 'name',
aspilicious's avatar
aspilicious committed
527
      'id' => 'argument_comment_user_uid',
merlinofchaos's avatar
merlinofchaos committed
528
529
530
531
532
533
      'no group by' => TRUE,
    ),
    'filter' => array(
      'field' => 'uid',
      'name table' => 'users',
      'name field' => 'name',
aspilicious's avatar
aspilicious committed
534
      'id' => 'comment_user_uid',
merlinofchaos's avatar
merlinofchaos committed
535
536
537
538
539
540
541
542
543
544
545
546
    ),
  );

  $data['node']['cid'] = array(
    'title' => t('Comments of the node'),
    'help' => t('Relate all comments on the node. This will create 1 duplicate record for every comment. Usually if you need this it is better to create a comment view.'),
    'relationship' => array(
      'group' => t('Comment'),
      'label' => t('Comments'),
      'base' => 'comment',
      'base field' => 'nid',
      'relationship field' => 'nid',
aspilicious's avatar
aspilicious committed
547
      'id' => 'standard',
merlinofchaos's avatar
merlinofchaos committed
548
549
550
551
    ),
  );

}
552
553
554
555
556
557
558
559
560
561

/**
 * Implements hook_views_plugins_row_alter().
 *
 * Replaces the generic row plugin by a custom one for comments.
 *
 * @see \Drupal\views\Plugin\views\row\EntityRow
 */
function comment_views_plugins_row_alter(array &$plugins) {
  $plugins['entity:comment']['class'] = 'Drupal\comment\Plugin\views\row\CommentRow';
562
  $plugins['entity:comment']['provider'] = 'comment';
563
}