function UpdateThemeHooks::preprocessUpdateLastCheck

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

array $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/src/Hook/UpdateThemeHooks.php, line 95

Class

UpdateThemeHooks
Theme hooks for update module.

Namespace

Drupal\update\Hook

Code

public function preprocessUpdateLastCheck(array &$variables) : void {
  $variables['time'] = $this->dateFormatter
    ->formatTimeDiffSince($variables['last']);
  $variables['link'] = Link::fromTextAndUrl($this->t('Check manually'), Url::fromRoute('update.manual_status', [], [
    'query' => $this->redirectDestination
      ->getAsArray(),
  ]))
    ->toString();
}

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