function template_preprocess_update_version

Same name in other branches
  1. 8.9.x core/modules/update/update.report.inc \template_preprocess_update_version()
  2. 10 core/modules/update/update.report.inc \template_preprocess_update_version()
  3. 11.x 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

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',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.