public static function EventLogStorage::getSearchData in Events Log Track 8
Same name and namespace in other branches
- 8.2 src/EventLogStorage.php \Drupal\event_log_track\EventLogStorage::getSearchData()
Display event data listing.
Parameters
array $getData: Filter to display data.
array $header: Data sorting type.
int $limit: Limit to display data.
Return value
array The result to display.
1 call to EventLogStorage::getSearchData()
- OverviewForm::buildForm in src/
OverviewForm.php - Form constructor.
File
- src/
EventLogStorage.php, line 23
Class
- EventLogStorage
- Controller class for event log track required special handling for events.
Namespace
Drupal\event_log_trackCode
public static function getSearchData(array $getData, array $header, $limit = NULL) {
$db = \Drupal::database();
$query = $db
->select('event_log_track', 'e');
$query
->fields('e');
$table_sort = $query
->extend('Drupal\\Core\\Database\\Query\\TableSortExtender')
->orderByHeader($header);
$pager = $table_sort
->extend('Drupal\\Core\\Database\\Query\\PagerSelectExtender')
->limit($limit);
// Apply filters.
if (!empty($getData['type'])) {
$query
->condition('type', $getData['type']);
if (!empty($getData['operation'])) {
$query
->condition('operation', $getData['operation']);
}
}
if (!empty($getData['id'])) {
$query
->condition('ref_numeric', $getData['id']);
}
if (!empty($getData['ip'])) {
$query
->condition('ip', $getData['ip']);
}
if (!empty($getData['name'])) {
$query
->condition('ref_char', $getData['name']);
}
if (!empty($getData['path'])) {
$query
->condition('path', '%' . db_like($getData['path']) . '%', 'LIKE');
}
if (!empty($getData['keyword'])) {
$query
->condition('description', '%' . db_like($getData['keyword']) . '%', 'LIKE');
}
if (!empty($getData['user'])) {
$getUid = substr($getData['user'], strrpos($getData['user'], '(') + 1, -1);
$query
->condition('uid', $getUid);
}
$result = $pager
->execute();
return $result;
}