annotate core/modules/dblog/dblog.admin.inc @ 19:fa3358dc1485 tip

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