You are here

function perfmon_reviewed in Performance monitor 8

Same name and namespace in other branches
  1. 7 perfmon.pages.inc \perfmon_reviewed()

Main page output.

1 call to perfmon_reviewed()
PerfmonController::mainPage in src/Controller/PerfmonController.php
Main perform results page callback.

File

./perfmon.module, line 735
Stand-alone perfmon test system.

Code

function perfmon_reviewed($testlist, $tests) {
  $items = array();
  $last_run = \Drupal::config('perfmon.settings')
    ->get('last_run');
  $date_formatter = \Drupal::service('date.formatter');
  $date = !empty($last_run) ? $date_formatter
    ->format($last_run, 'long') : '';
  $header = t('Review results from last run @date', [
    '@date' => $date,
  ]);
  $desc = t("Here you can review the results from the last run of the testlist. You can run the testlist again by expanding the fieldset above.");
  foreach ($tests as $test) {

    // Skip this iteration if the result has no matching item in the testlist.
    if (!isset($testlist[$test['testname']])) {
      continue;
    }
    $message = $testlist[$test['testname']]['title'];
    $title = t('OK');
    $class = 'ok';
    $bold = FALSE;
    if ($test['testname'] == 'config') {
      $bold = TRUE;
    }
    $items[] = array(
      'title' => $title,
      'bold' => $bold,
      'value' => $test['result'],
      'class' => $class,
      'message' => $message,
      'help_link' => 'DeleteLINK',
    );
  }
  $output = [
    '#theme' => 'perfmon_reviewed',
    '#items' => $items,
    '#header' => $header,
    '#description' => $desc,
  ];
  return $output;
}