dblog.views.inc 4.4 KB

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