You are here

protected function RequestController::buildMainTableRows in MongoDB 8.2

Build the main table rows.

Parameters

\Drupal\mongodb_watchdog\EventTemplate[]\Drupal\mongodb_watchdog\Event[] $events: A fully loaded array of events and their templates.

Return value

array A render array for a table.

1 call to RequestController::buildMainTableRows()
RequestController::buildMainTable in modules/mongodb_watchdog/src/Controller/RequestController.php
Build the main table.

File

modules/mongodb_watchdog/src/Controller/RequestController.php, line 155

Class

RequestController
The controller for the request events page.

Namespace

Drupal\mongodb_watchdog\Controller

Code

protected function buildMainTableRows(array $events) : array {
  $rows = [];
  $levels = $this->rfcLogLevel
    ->getLevels();
  $event = NULL;
  $template = NULL;

  /** @var \Drupal\mongodb_watchdog\EventTemplate $template */

  /** @var \Drupal\mongodb_watchdog\Event $event */
  foreach ($events as [
    $template,
    $event,
  ]) {
    $row = [];
    $row[] = [
      'data' => $event->requestTracking_sequence,
    ];
    $row[] = $template->type;
    $row[] = [
      'data' => $levels[$template->severity],
      'class' => OverviewController::SEVERITY_CLASSES[$template->severity],
    ];
    $row[] = [
      'data' => Link::createFromRoute($template
        ->asString($event->variables), 'mongodb_watchdog.reports.detail', [
        'eventTemplate' => $template->_id,
      ]),
    ];
    $row[] = $this
      ->simplifyPath($event->variables['%file']);
    $row[] = $event->variables['%line'];
    $rows[] = $row;
  }
  return $rows;
}