DbLogController::buildFilterQuery

protected DbLogController::buildFilterQuery()

Builds a query for database log administration filters based on session.

Return value

array An associative array with keys 'where' and 'args'.

File

core/modules/dblog/src/Controller/DbLogController.php, line 304

Class

DbLogController
Returns responses for dblog routes.

Namespace

Drupal\dblog\Controller

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
protected function buildFilterQuery() {
  if (empty($_SESSION['dblog_overview_filter'])) {
    return;
  }
 
  $this->moduleHandler->loadInclude('dblog', 'admin.inc');
 
  $filters = dblog_filters();
 
  // Build query.
  $where = $args = array();
  foreach ($_SESSION['dblog_overview_filter'] as $key => $filter) {
    $filter_where = array();
    foreach ($filter as $value) {
      $filter_where[] = $filters[$key]['where'];
      $args[] = $value;
    }
    if (!empty($filter_where)) {
      $where[] = '(' . implode(' OR ', $filter_where) . ')';
    }
  }
  $where = !empty($where) ? implode(' AND ', $where) : '';
 
  return array(
    'where' => $where,
    'args' => $args,
  );
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.