You are here

function cs_log_filters in Content Synchronization 3.0.x

Same name and namespace in other branches
  1. 8.2 content_sync.admin.inc \cs_log_filters()
  2. 8 content_sync.admin.inc \cs_log_filters()

Creates a list of database log administration filters that can be applied.

Return value

array Associative array of filters. The top-level keys are used as the form element names for the filters, and the values are arrays with the following elements:

  • title: Title of the filter.
  • where: The filter condition.
  • options: Array of options for the select list for the filter.
2 calls to cs_log_filters()
ContentLogController::buildFilterQuery in src/Controller/ContentLogController.php
Builds a query for database log administration filters based on session.
ContentLogFilterForm::submitForm in src/Form/ContentLogFilterForm.php
Form submission handler.

File

./content_sync.admin.inc, line 21
Administrative page callbacks for the Database Logging module.

Code

function cs_log_filters() {
  $filters = [];
  foreach (_dblog_get_message_types() as $type) {
    $types[$type] = t($type);
  }
  if (!empty($types)) {
    $filters['type'] = [
      'title' => t('Type'),
      'where' => "w.type = ?",
      'options' => $types,
    ];
  }
  $filters['severity'] = [
    'title' => t('Severity'),
    'where' => 'w.severity = ?',
    'options' => RfcLogLevel::getLevels(),
  ];
  return $filters;
}