Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
4f5d8582
Commit
4f5d8582
authored
Aug 04, 2014
by
alexpott
Browse files
Issue
#2264833
by lokeoke, joelpittet: Convert theme_update_version to update-version.html.twig.
parent
7e394b02
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/update/templates/update-version.html.twig
0 → 100644
View file @
4f5d8582
{#
/**
* @file
* Default theme implementation for the version display of a project.
*
* Available variables:
* - attributes: HTML attributes suitable for a container element.
* - 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.
*
* @see template_preprocess_update_version()
*
* @ingroup themeable
*/
#}
<table
class=
"
{{
attributes.class
}}
version"
{{
attributes
|
without
(
'class'
)
}}
>
<tr>
<td
class=
"version-title"
>
{{
title
}}
</td>
<td
class=
"version-details"
>
<a
href=
"
{{
version.release_link
}}
"
>
{{
version.version
}}
</a>
<span
class=
"version-date"
>
(
{{
version.date
|
date
(
'Y-M-d'
)
}}
)
</span>
</td>
<td
class=
"version-links"
>
<ul
class=
"links"
>
<li
class=
"download"
>
<a
href=
"
{{
version.download_link
}}
"
>
{{
'Download'
|
t
}}
</a>
</li>
<li
class=
"release-notes"
>
<a
href=
"
{{
version.release_link
}}
"
>
{{
'Release notes'
|
t
}}
</a>
</li>
</ul>
</td>
</tr>
</table>
core/modules/update/update.module
View file @
4f5d8582
...
...
@@ -189,8 +189,11 @@ function update_theme() {
'template'
=>
'update-project-status'
,
),
'update_version'
=>
array
(
'variables'
=>
array
(
'version'
=>
NULL
,
't
ag
'
=>
NULL
,
'
clas
s'
=>
array
()),
'variables'
=>
array
(
'version'
=>
NULL
,
't
itle
'
=>
NULL
,
'
attribute
s'
=>
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'
,
),
);
}
...
...
core/modules/update/update.report.inc
View file @
4f5d8582
...
...
@@ -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
.
=
'<table class="version '
.
$class
.
'">'
;
$output
.
=
'<tr>'
;
$output
.
=
'<td class="version-title">'
.
$tag
.
"</td>
\n
"
;
$output
.
=
'<td class="version-details">'
;
$output
.
=
l
(
$version
[
'version'
],
$version
[
'release_link'
]);
$output
.
=
' <span class="version-date">('
.
format_date
(
$version
[
'date'
],
'custom'
,
'Y-M-d'
)
.
')</span>'
;
$output
.
=
"</td>
\n
"
;
$output
.
=
'<td class="version-links">'
;
$links
=
array
();
$links
[
'update-download'
]
=
array
(
'title'
=>
t
(
'Download'
),
'href'
=>
$version
[
'download_link'
],
);
$links
[
'update-release-notes'
]
=
array
(
'title'
=>
t
(
'Release notes'
),
'href'
=>
$version
[
'release_link'
],
);
$links__update_version
=
array
(
'#theme'
=>
'links__update_version'
,
'#links'
=>
$links
,
);
$output
.
=
drupal_render
(
$links__update_version
);
$output
.
=
'</td>'
;
$output
.
=
'</tr>'
;
$output
.
=
"</table>
\n
"
;
return
$output
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment