You are here

protected function InstallProfile::formatRequirementsReasons in Helper 8

Convert an array of requirements into a simpler list of reasons.

Parameters

array $requirements: An array of requirements from hook_requirements().

Return value

string[] An array of requirement reasons as strings.

1 call to InstallProfile::formatRequirementsReasons()
InstallProfile::validateProfile in src/InstallProfile.php
Validates a profile and checks its various requirements.

File

src/InstallProfile.php, line 222

Class

InstallProfile
Helpers related to working with install profiles.

Namespace

Drupal\helper

Code

protected function formatRequirementsReasons(array $requirements) {
  $reasons = [];
  foreach ($requirements as $id => $requirement) {
    if (isset($requirement['severity']) && $requirement['severity'] === REQUIREMENT_ERROR) {
      if (isset($requirement['value']) && $requirement['value']) {
        $reasons[$id] = $this
          ->t('@requirements_message (Currently using @item version @version)', [
          '@requirements_message' => $requirement['description'],
          '@item' => $requirement['title'],
          '@version' => $requirement['value'],
        ]);
      }
      else {
        $reasons[$id] = (string) $requirement['description'];
      }
    }
  }
  return $reasons;
}