diff --git a/core/modules/update/templates/update-last-check.html.twig b/core/modules/update/templates/update-last-check.html.twig new file mode 100644 index 0000000..9e70cee --- /dev/null +++ b/core/modules/update/templates/update-last-check.html.twig @@ -0,0 +1,25 @@ +{# +/** + * @file + * Default theme implementation for the last of update data templates. + * + * Available variables: + * - last_checked: A flag indicating whether the site checked for updates. + * - time: The time the site last checked for updates. + * - link: A link to check for updates manually. + * + * @see template_preprocess_update_last_check() + * + * @ingroup themeable + */ +#} +
+ {% if last_checked %} + {% trans %} + Last checked: {{ time }} ago + {% endtrans %} + {% else %} + {{ 'Last checked: never'|t }} + {% endif %} + ({{ link }}) +
diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 6341857..0c08152 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -174,6 +174,7 @@ function update_theme() { ), 'update_last_check' => array( 'variables' => array('last' => NULL), + 'template' => 'update-last-check', ), 'update_report' => array( 'variables' => array('data' => NULL), @@ -551,7 +552,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 @@ -565,13 +568,11 @@ function _update_project_status_sort($a, $b) { * @see theme_update_available_updates_form() * @ingroup themeable */ -function theme_update_last_check($variables) { +function template_preprocess_update_last_check(&$variables) { $last = $variables['last']; - $output = '
'; - $output .= $last ? t('Last checked: @time ago', array('@time' => format_interval(REQUEST_TIME - $last))) : t('Last checked: never'); - $output .= ' (' . l(t('Check manually'), 'admin/reports/updates/check', array('query' => drupal_get_destination())) . ')'; - $output .= "
\n"; - return $output; + $variables['last_checked'] = ($last != NULL); + $variables['time'] = format_interval(REQUEST_TIME - $last); + $variables['link'] = \Drupal::l(t('Check manually'), 'update.manual_status', array(), array('query' => drupal_get_destination())); } /**