You are here

function lockr_preprocess_status_report in Lockr 8.4

Same name and namespace in other branches
  1. 8.2 src/Controller/LockrAdminController.php \Drupal\lockr\Controller\lockr_preprocess_status_report()
  2. 8.3 src/Controller/LockrAdminController.php \Drupal\lockr\Controller\lockr_preprocess_status_report()
  3. 4.x src/Controller/LockrAdminController.php \Drupal\lockr\Controller\lockr_preprocess_status_report()

Copied from previous version of core.

Ensures that the status table requirements are properly formatted.

1 call to lockr_preprocess_status_report()
LockrAdminController::getStatus in src/Controller/LockrAdminController.php
Renders the Lockr status table.

File

src/Controller/LockrAdminController.php, line 284

Namespace

Drupal\lockr\Controller

Code

function lockr_preprocess_status_report(&$reqs) {
  $severities = [
    REQUIREMENT_INFO => [
      'title' => t('Info'),
      'status' => 'info',
    ],
    REQUIREMENT_OK => [
      'title' => t('OK'),
      'status' => 'ok',
    ],
    REQUIREMENT_WARNING => [
      'title' => t('Warning'),
      'status' => 'warning',
    ],
    REQUIREMENT_ERROR => [
      'title' => t('Error'),
      'status' => 'error',
    ],
  ];
  foreach ($reqs as $i => $requirement) {

    // Always use the explicit requirement severity, if defined. Otherwise,
    // default to REQUIREMENT_OK in the installer to visually confirm that
    // installation requirements are met. And default to REQUIREMENT_INFO to
    // denote neutral information without special visualization.
    if (isset($requirement['severity'])) {
      $severity = $severities[(int) $requirement['severity']];
    }
    elseif (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE === 'install') {
      $severity = $severities[REQUIREMENT_OK];
    }
    else {
      $severity = $severities[REQUIREMENT_INFO];
    }
    $reqs[$i]['severity_title'] = $severity['title'];
    $reqs[$i]['severity_status'] = $severity['status'];
  }
}