You are here

function template_preprocess_update_version in Drupal 8

Same name and namespace in other branches
  1. 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 115
Code required only when rendering the available updates report.

Code

function template_preprocess_update_version(array &$variables) {
  $version = $variables['version'];
  if (empty($version['core_compatibility_message'])) {
    return;
  }
  $core_compatible = !empty($version['core_compatible']);
  $variables['core_compatibility_details'] = [
    '#type' => 'details',
    '#title' => $core_compatible ? t('Compatible') : t('Not compatible'),
    '#open' => !$core_compatible,
    'message' => [
      '#markup' => $version['core_compatibility_message'],
    ],
    '#attributes' => [
      'class' => [
        $core_compatible ? 'compatible' : 'not-compatible',
      ],
    ],
  ];
}