dblog.admin.inc 982 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * @file
  4. * Administrative page callbacks for the Database Logging module.
  5. */
  6. use Drupal\Core\Logger\RfcLogLevel;
  7. /**
  8. * Creates a list of database log administration filters that can be applied.
  9. *
  10. * @return array
  11. * Associative array of filters. The top-level keys are used as the form
  12. * element names for the filters, and the values are arrays with the following
  13. * elements:
  14. * - title: Title of the filter.
  15. * - where: The filter condition.
  16. * - options: Array of options for the select list for the filter.
  17. */
  18. function dblog_filters() {
  19. $filters = [];
  20. foreach (_dblog_get_message_types() as $type) {
  21. $types[$type] = t($type);
  22. }
  23. if (!empty($types)) {
  24. $filters['type'] = [
  25. 'title' => t('Type'),
  26. 'where' => "w.type = ?",
  27. 'options' => $types,
  28. ];
  29. }
  30. $filters['severity'] = [
  31. 'title' => t('Severity'),
  32. 'where' => 'w.severity = ?',
  33. 'options' => RfcLogLevel::getLevels(),
  34. ];
  35. return $filters;
  36. }