comparison core/modules/dblog/dblog.admin.inc @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 /**
4 * @file
5 * Administrative page callbacks for the Database Logging module.
6 */
7
8 use Drupal\Core\Logger\RfcLogLevel;
9
10 /**
11 * Creates a list of database log administration filters that can be applied.
12 *
13 * @return array
14 * Associative array of filters. The top-level keys are used as the form
15 * element names for the filters, and the values are arrays with the following
16 * elements:
17 * - title: Title of the filter.
18 * - where: The filter condition.
19 * - options: Array of options for the select list for the filter.
20 */
21 function dblog_filters() {
22 $filters = [];
23
24 foreach (_dblog_get_message_types() as $type) {
25 $types[$type] = t($type);
26 }
27
28 if (!empty($types)) {
29 $filters['type'] = [
30 'title' => t('Type'),
31 'where' => "w.type = ?",
32 'options' => $types,
33 ];
34 }
35
36 $filters['severity'] = [
37 'title' => t('Severity'),
38 'where' => 'w.severity = ?',
39 'options' => RfcLogLevel::getLevels(),
40 ];
41
42 return $filters;
43 }