You are here

protected function DetailController::getTop in MongoDB 8.2

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

Parameters

\Drupal\mongodb_watchdog\EventTemplate|null $eventTemplate: The template for which to provide details. Not actually expected to be NULL, but this is needed to remain compatible with parent class.

Return value

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

Overrides ControllerBase::getTop

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

File

modules/mongodb_watchdog/src/Controller/DetailController.php, line 214

Class

DetailController
The controller for the event detail page.

Namespace

Drupal\mongodb_watchdog\Controller

Code

protected function getTop(EventTemplate $eventTemplate = NULL) : array {
  $rows = [];
  foreach ($eventTemplate
    ->keys() as $key => $info) {
    $value = $eventTemplate->{$key};
    $row = [];
    $row[] = [
      'header' => TRUE,
      'data' => $info['label'],
    ];
    $row[] = isset($info['display_callback']) ? $info['display_callback']($value) : $value;
    $rows[] = $row;
  }
  $ret = [
    '#caption' => $this
      ->t('Event template'),
    '#rows' => $rows,
    '#type' => 'table',
  ];
  return $ret;
}