function template_preprocess_authorize_report

Same name in other branches
  1. 9 core/includes/theme.maintenance.inc \template_preprocess_authorize_report()
  2. 10 core/includes/theme.maintenance.inc \template_preprocess_authorize_report()
  3. 11.x 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 114

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.