function StatusReport::preRenderGroupRequirements
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Render/Element/StatusReport.php \Drupal\Core\Render\Element\StatusReport::preRenderGroupRequirements()
- 10 core/lib/Drupal/Core/Render/Element/StatusReport.php \Drupal\Core\Render\Element\StatusReport::preRenderGroupRequirements()
- 11.x core/lib/Drupal/Core/Render/Element/StatusReport.php \Drupal\Core\Render\Element\StatusReport::preRenderGroupRequirements()
#pre_render callback to group requirements.
File
-
core/
lib/ Drupal/ Core/ Render/ Element/ StatusReport.php, line 34
Class
- StatusReport
- Creates status report page element.
Namespace
Drupal\Core\Render\ElementCode
public static function preRenderGroupRequirements($element) {
$severities = static::getSeverities();
$grouped_requirements = [];
foreach ($element['#requirements'] as $key => $requirement) {
$severity = $severities[REQUIREMENT_INFO];
if (isset($requirement['severity'])) {
$requirement_severity = (int) $requirement['severity'] === REQUIREMENT_OK ? REQUIREMENT_INFO : (int) $requirement['severity'];
$severity = $severities[$requirement_severity];
}
elseif (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install') {
$severity = $severities[REQUIREMENT_OK];
}
$grouped_requirements[$severity['status']]['title'] = $severity['title'];
$grouped_requirements[$severity['status']]['type'] = $severity['status'];
$grouped_requirements[$severity['status']]['items'][$key] = $requirement;
}
// Order the grouped requirements by a set order.
$order = array_flip($element['#priorities']);
uksort($grouped_requirements, function ($a, $b) use ($order) {
return $order[$a] <=> $order[$b];
});
$element['#grouped_requirements'] = $grouped_requirements;
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.