W3cubDocs

/Drupal 8

function template_preprocess_update_last_check

template_preprocess_update_last_check(&$variables)

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 567
Handles updates of Drupal core and contributed projects.

Code

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!update!update.module/function/template_preprocess_update_last_check/8.1.x