You are here

protected function RequestController::getTop in MongoDB 8.2

Build the heading rows on the per-request event occurrences page.

Parameters

string $uniqueId: The unique request id.

\Drupal\mongodb_watchdog\Event|null $first: A fully loaded array of events and their templates.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup[] A render array for a table.

Overrides ControllerBase::getTop

1 call to RequestController::getTop()
RequestController::build in modules/mongodb_watchdog/src/Controller/RequestController.php
Controller.

File

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

Class

RequestController
The controller for the request events page.

Namespace

Drupal\mongodb_watchdog\Controller

Code

protected function getTop(string $uniqueId = "", ?Event $first = NULL) : array {
  $timestamp = isset($first->timestamp) ? $this->dateFormatter
    ->format($first->timestamp, 'long') : $this
    ->t('No information');
  $rows = [
    [
      $this
        ->t('Request ID'),
      $uniqueId,
    ],
    [
      $this
        ->t('Location'),
      $first
        ->location(),
    ],
    [
      $this
        ->t('Date/time'),
      $timestamp,
    ],
  ];
  foreach ($rows as &$row) {
    $row[0] = [
      'data' => $row[0],
      'header' => TRUE,
    ];
  }
  $ret = [
    '#caption' => $this
      ->t('Request'),
    '#rows' => $rows,
    '#type' => 'table',
  ];
  return $ret;
}