function template_preprocess_update_last_check

Same name in other branches
  1. 9 core/modules/update/update.module \template_preprocess_update_last_check()
  2. 10 core/modules/update/update.module \template_preprocess_update_last_check()
  3. 11.x core/modules/update/update.module \template_preprocess_update_last_check()

Prepares variables for last time update data was checked templates.

Default template: update-last-check.html.twig.

In addition to properly formatting the given timestamp, this function also provides a "Check manually" link that refreshes the available update and redirects back to the same page.

Parameters

$variables: An associative array containing:

  • last: The timestamp when the site last checked for available updates.

See also

theme_update_report()

File

core/modules/update/update.module, line 657

Code

function template_preprocess_update_last_check(&$variables) {
    $variables['time'] = \Drupal::service('date.formatter')->formatTimeDiffSince($variables['last']);
    $variables['link'] = Link::fromTextAndUrl(t('Check manually'), Url::fromRoute('update.manual_status', [], [
        'query' => \Drupal::destination()->getAsArray(),
    ]))
        ->toString();
}

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