diff --git a/core/modules/update/templates/update-version.html.twig b/core/modules/update/templates/update-version.html.twig new file mode 100644 index 0000000..e5e483d --- /dev/null +++ b/core/modules/update/templates/update-version.html.twig @@ -0,0 +1,38 @@ +{# +/** + * @file + * Default theme implementation for the version display of a project. + * + * Available variables: + * - title: The title of the project. + * - version: A list of data about the latest released version, containing: + * - version: The version number. + * - date: The date of the release. + * - download_link: The URL for the downloadable file. + * - release_link: The URL for the release notes. + * - attributes: HTML attributes for the update versions table. + * + * @see template_preprocess_update_version() + * + * @ingroup themeable + */ +#} + + + + + + +
{{ title }} + {{ version.version }} + ({{ version.date|date('Y-M-d') }}) +
diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 7ef5afd..f56fa87 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -189,8 +189,12 @@ function update_theme() { 'template' => 'update-project-status', ), 'update_version' => array( - 'variables' => array('version' => NULL, 'tag' => NULL, 'class' => array()), + 'variables' => array('version' => NULL, 'title' => NULL, 'attributes' => array()), 'file' => 'update.report.inc', + // We are using template instead of '#type' => 'table' here to + // keep markup out of preprocess and allow for easier + // changes to markup. + 'template' => 'update-version', ), ); } diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index bf3d6ae..62fa613 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -352,52 +352,3 @@ function template_preprocess_update_project_status(&$variables) { '#title' => $text, ); } - -/** - * Returns HTML for the version display of a project. - * - * @param array $variables - * An associative array containing: - * - version: An array of data about the latest released version, containing: - * - version: The version number. - * - release_link: The URL for the release notes. - * - date: The date of the release. - * - download_link: The URL for the downloadable file. - * - tag: The title of the project. - * - class: A string containing extra classes for the wrapping table. - * - * @ingroup themeable - */ -function theme_update_version($variables) { - $version = $variables['version']; - $tag = $variables['tag']; - $class = implode(' ', $variables['class']); - - $output = ''; - $output .= ''; - $output .= ''; - $output .= '\n"; - $output .= '\n"; - $output .= ''; - $output .= ''; - $output .= "
' . $tag . "'; - $output .= l($version['version'], $version['release_link']); - $output .= ' (' . format_date($version['date'], 'custom', 'Y-M-d') . ')'; - $output .= "
\n"; - return $output; -}