public function DevelDebugLogController::listLogs in Devel Debug Log 8
Lists debug information.
Return value
array Renderable array that contains a list of debug data.
1 string reference to 'DevelDebugLogController::listLogs'
File
- src/
Controller/ DevelDebugLogController.php, line 75
Class
Namespace
Drupal\devel_debug_log\ControllerCode
public function listLogs() {
$query = $this->database
->select('devel_debug_log', 'm')
->extend('Drupal\\Core\\Database\\Query\\PagerSelectExtender');
$results = $query
->fields('m', [
'timestamp',
'title',
'message',
])
->orderBy('id', 'desc')
->execute();
$rows = [];
foreach ($results as $result) {
$rows[] = array(
'title' => $result->title,
'time' => $this->dateFormatter
->format($result->timestamp, 'short'),
'message' => $result->message,
);
}
if (empty($rows)) {
return array(
'#markup' => $this
->t('No debug messages.'),
);
}
$build = array(
'messages' => array(
'#theme' => 'devel_debug_log_list',
'#content' => $rows,
'#delete_form' => $this->formBuilder
->getForm('Drupal\\devel_debug_log\\Form\\DevelDebugLogDeleteForm'),
),
'pager' => array(
'#type' => 'pager',
),
);
return $build;
}