You are here

protected function AdminReadinessMessages::displayResultsForSeverity in Automatic Updates 8.2

Displays the results for severity.

Parameters

int $severity: The severity for the results to display. Should be one of the SystemManager::REQUIREMENT_* constants.

Return value

bool Whether any results were displayed.

1 call to AdminReadinessMessages::displayResultsForSeverity()
AdminReadinessMessages::displayAdminPageMessages in src/Validation/AdminReadinessMessages.php
Displays the checker results messages on admin pages.

File

src/Validation/AdminReadinessMessages.php, line 159

Class

AdminReadinessMessages
Class for displaying readiness messages on admin pages.

Namespace

Drupal\automatic_updates\Validation

Code

protected function displayResultsForSeverity(int $severity) : bool {
  $results = $this->readinessCheckerManager
    ->getResults($severity);
  if (empty($results)) {
    return FALSE;
  }
  $failure_message = $this
    ->getFailureMessageForSeverity($severity);
  if ($severity === SystemManager::REQUIREMENT_ERROR) {
    $this
      ->messenger()
      ->addError($failure_message);
  }
  else {
    $this
      ->messenger()
      ->addWarning($failure_message);
  }
  foreach ($results as $result) {
    $messages = $result
      ->getMessages();
    $message = count($messages) === 1 ? $messages[0] : $result
      ->getSummary();
    if ($severity === SystemManager::REQUIREMENT_ERROR) {
      $this
        ->messenger()
        ->addError($message);
    }
    else {
      $this
        ->messenger()
        ->addWarning($message);
    }
  }
  return TRUE;
}