Commit 432b5a78 authored by alexpott's avatar alexpott

Issue #2264753 by cfox612, Cottser, a-fro, joelpittet: Convert...

Issue #2264753 by cfox612, Cottser, a-fro, joelpittet: Convert theme_update_last_check to update-last-check.html.twig.
parent b962ed44
{#
/**
* @file
* Default theme implementation for the last time update data was checked.
*
* Available variables:
* - last: The timestamp that the site was last checked for updates.
* - time: The formatted time since the site last checked for updates.
* - link: A link to check for updates manually.
*
* @see template_preprocess_update_last_check()
*
* @ingroup themeable
*/
#}
<div class="update checked">
{% if last %}
{{ 'Last checked: @time ago'|t({'@time': time}) }}
{% else %}
{{ 'Last checked: never'|t }}
{% endif %}
<span class="check-manually">({{ link }})</span>
</div>
......@@ -177,7 +177,8 @@ function update_theme() {
'file' => 'update.manager.inc',
),
'update_last_check' => array(
'variables' => array('last' => NULL),
'variables' => array('last' => 0),
'template' => 'update-last-check',
),
'update_report' => array(
'variables' => array('data' => NULL),
......@@ -555,7 +556,9 @@ function _update_project_status_sort($a, $b) {
}
/**
* Returns HTML for the last time we checked for update data.
* 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
......@@ -566,16 +569,10 @@ function _update_project_status_sort($a, $b) {
* - last: The timestamp when the site last checked for available updates.
*
* @see theme_update_report()
* @see theme_update_available_updates_form()
* @ingroup themeable
*/
function theme_update_last_check($variables) {
$last = $variables['last'];
$output = '<div class="update checked">';
$output .= $last ? t('Last checked: @time ago', array('@time' => format_interval(REQUEST_TIME - $last))) : t('Last checked: never');
$output .= ' <span class="check-manually">(' . l(t('Check manually'), 'admin/reports/updates/check', array('query' => drupal_get_destination())) . ')</span>';
$output .= "</div>\n";
return $output;
*/
function template_preprocess_update_last_check(&$variables) {
$variables['time'] = \Drupal::service('date')->formatInterval(REQUEST_TIME - $variables['last']);
$variables['link'] = \Drupal::l(t('Check manually'), 'update.manual_status', array(), array('query' => drupal_get_destination()));
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment