You are here

function template_preprocess_authorize_report in Drupal 10

Same name and namespace in other branches
  1. 8 core/includes/theme.maintenance.inc \template_preprocess_authorize_report()
  2. 9 core/includes/theme.maintenance.inc \template_preprocess_authorize_report()

Prepares variables for authorize.php operation report templates.

This report displays the results of an operation run via authorize.php.

Default template: authorize-report.html.twig.

Parameters

array $variables: An associative array containing:

  • messages: An array of result messages.

File

core/includes/theme.maintenance.inc, line 111
Theming for maintenance pages.

Code

function template_preprocess_authorize_report(&$variables) {
  $messages = [];
  if (!empty($variables['messages'])) {
    foreach ($variables['messages'] as $heading => $logs) {
      $items = [];
      foreach ($logs as $number => $log_message) {
        if ($number === '#abort') {
          continue;
        }
        $class = 'authorize-results__' . ($log_message['success'] ? 'success' : 'failure');
        $items[] = [
          '#wrapper_attributes' => [
            'class' => [
              $class,
            ],
          ],
          '#markup' => $log_message['message'],
        ];
      }
      $messages[] = [
        '#theme' => 'item_list',
        '#items' => $items,
        '#title' => $heading,
      ];
    }
  }
  $variables['messages'] = $messages;
}