function template_preprocess_update_version in Drupal 10
Same name and namespace in other branches
- 8 core/modules/update/update.report.inc \template_preprocess_update_version()
- 9 core/modules/update/update.report.inc \template_preprocess_update_version()
Prepares variables for update version templates.
Default template: update-version.html.twig.
Parameters
array $variables: An associative array containing:
- version: An array of information about the release version.
File
- core/
modules/ update/ update.report.inc, line 116 - Code required only when rendering the available updates report.
Code
function template_preprocess_update_version(array &$variables) {
$release = ProjectRelease::createFromArray($variables['version']);
if (!$release
->getCoreCompatibilityMessage()) {
return;
}
$core_compatible = $release
->isCoreCompatible();
$variables['core_compatibility_details'] = [
'#type' => 'details',
'#title' => $core_compatible ? t('Compatible') : t('Not compatible'),
'#open' => !$core_compatible,
'message' => [
'#markup' => $release
->getCoreCompatibilityMessage(),
],
'#attributes' => [
'class' => [
$core_compatible ? 'compatible' : 'not-compatible',
],
],
];
}