function UpdateThemeHooks::preprocessUpdateVersion
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/ src/ Hook/ UpdateThemeHooks.php, line 202
Class
- UpdateThemeHooks
- Theme hooks for update module.
Namespace
Drupal\update\HookCode
public function preprocessUpdateVersion(array &$variables) : void {
$release = ProjectRelease::createFromArray($variables['version']);
if (!$release->getCoreCompatibilityMessage()) {
return;
}
$core_compatible = $release->isCoreCompatible();
$variables['core_compatibility_details'] = [
'#type' => 'details',
'#title' => $core_compatible ? $this->t('Compatible') : $this->t('Not compatible'),
'#open' => !$core_compatible,
'message' => [
'#markup' => $release->getCoreCompatibilityMessage(),
],
'#attributes' => [
'class' => [
$core_compatible ? 'compatible' : 'not-compatible',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.