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 6341857..97af32e 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -180,8 +180,9 @@ function update_theme() { 'file' => 'update.report.inc', ), 'update_version' => array( - 'variables' => array('version' => NULL, 'tag' => NULL, 'class' => array()), + 'variables' => array('version' => NULL, 'title' => NULL, 'attributes' => array()), 'file' => 'update.report.inc', + 'template' => 'update-version', ), 'update_status_label' => array( 'variables' => array('status' => NULL), diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 6a06cbe..ab8c462 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -137,8 +137,8 @@ function theme_update_report($variables) { $update_version = array( '#theme' => 'update_version', '#version' => $project['releases'][$project['recommended']], - '#tag' => t('Recommended version:'), - '#class' => $version_class, + '#title' => t('Recommended version:'), + '#attributes' => array('class' => $version_class), ); $versions_inner .= drupal_render($update_version); } @@ -150,8 +150,8 @@ function theme_update_report($variables) { $update_version = array( '#theme' => 'update_version', '#version' => $security_update, - '#tag' => t('Security update:'), - '#class' => $security_class, + '#title' => t('Security update:'), + '#attributes' => array('class' => $security_class), ); $versions_inner .= drupal_render($update_version); } @@ -162,8 +162,8 @@ function theme_update_report($variables) { $update_version = array( '#theme' => 'update_version', '#version' => $project['releases'][$project['latest_version']], - '#tag' => t('Latest version:'), - '#class' => array('version-latest'), + '#title' => t('Latest version:'), + '#attributes' => array('class' => array('version-latest')), ); $versions_inner .= drupal_render($update_version); } @@ -174,8 +174,8 @@ function theme_update_report($variables) { $update_version = array( '#theme' => 'update_version', '#version' => $project['releases'][$project['dev_version']], - '#tag' => t('Development version:'), - '#class' => array('version-latest'), + '#title' => t('Development version:'), + '#attributes' => array('class' => array('version-latest')), ); $versions_inner .= drupal_render($update_version); } @@ -186,8 +186,8 @@ function theme_update_report($variables) { $update_version = array( '#theme' => 'update_version', '#version' => $project['releases'][$also], - '#tag' => t('Also available:'), - '#class' => array('version-also-available'), + '#title' => t('Also available:'), + '#attributes' => array('class' => array('version-also-available')), ); $versions_inner .= drupal_render($update_version); } @@ -335,52 +335,3 @@ function theme_update_status_label($variables) { } } - -/** - * 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; -}