Commit 79f952a0 authored by alexpott's avatar alexpott

Issue #2329851 by lanchez, lauriii, Jolidog | davidhernandez: Move...

Issue #2329851 by lanchez, lauriii, Jolidog | davidhernandez: Move miscellaneous system classes from preprocess to templates.
parent af221c8f
......@@ -200,6 +200,7 @@ public function themesPage() {
continue;
}
$theme->is_default = ($theme->getName() == $theme_default);
$theme->is_admin = ($theme->getName() == $admin_theme || ($theme->is_default && $admin_theme == '0'));
// Identify theme screenshot.
$theme->screenshot = NULL;
......@@ -284,13 +285,10 @@ public function themesPage() {
// Add notes to default and administration theme.
$theme->notes = array();
$theme->classes = array();
if ($theme->is_default) {
$theme->classes[] = 'theme-default';
$theme->notes[] = $this->t('default theme');
}
if ($theme->getName() == $admin_theme || ($theme->is_default && $admin_theme == '0')) {
$theme->classes[] = 'theme-admin';
if ($theme->is_admin) {
$theme->notes[] = $this->t('admin theme');
}
......
......@@ -53,14 +53,10 @@ function _system_is_incompatible(&$incompatible, $files, Extension $file) {
*/
function template_preprocess_admin_block_content(&$variables) {
if (!empty($variables['content'])) {
$compact = system_admin_compact_mode();
$variables['attributes'] = array('class' => array('admin-list'));
if ($compact) {
$variables['attributes']['class'][] = 'compact';
}
$variables['compact'] = system_admin_compact_mode();
foreach ($variables['content'] as $key => $item) {
$variables['content'][$key]['link'] = \Drupal::l($item['title'], $item['url']);
if (!$compact && isset($item['description'])) {
if (!$variables['compact'] && isset($item['description'])) {
$variables['content'][$key]['description'] = Xss::filterAdmin($item['description']);
}
else {
......@@ -164,19 +160,19 @@ function template_preprocess_status_report(&$variables) {
$severities = array(
REQUIREMENT_INFO => array(
'title' => t('Info'),
'class' => 'info',
'status' => 'info',
),
REQUIREMENT_OK => array(
'title' => t('OK'),
'class' => 'ok',
'status' => 'ok',
),
REQUIREMENT_WARNING => array(
'title' => t('Warning'),
'class' => 'warning',
'status' => 'warning',
),
REQUIREMENT_ERROR => array(
'title' => t('Error'),
'class' => 'error',
'status' => 'error',
),
);
......@@ -194,8 +190,8 @@ function template_preprocess_status_report(&$variables) {
else {
$severity = $severities[REQUIREMENT_INFO];
}
$variables['requirements'][$i]['severity_class'] = $severity['class'];
$variables['requirements'][$i]['severity_title'] = $severity['title'];
$variables['requirements'][$i]['severity_status'] = $severity['status'];
}
}
......@@ -375,7 +371,7 @@ function template_preprocess_system_themes_page(&$variables) {
$theme_group['state'] = $state;
$theme_group['title'] = $title;
$theme_group['themes'] = array();
$theme_group['attributes'] = new Attribute(array('class' => array('system-themes-list', 'system-themes-list-' . $state, 'clearfix')));
$theme_group['attributes'] = new Attribute();
foreach ($theme_groups[$state] as $theme) {
$current_theme = array();
......@@ -403,13 +399,12 @@ function template_preprocess_system_themes_page(&$variables) {
// Localize the theme description.
$current_theme['description'] = t($theme->info['description']);
// Style theme info.
$theme->classes[] = 'theme-selector';
$theme->classes[] = 'clearfix';
$current_theme['attributes'] = new Attribute(array('class' => $theme->classes));
$current_theme['attributes'] = new Attribute();
$current_theme['name'] = $theme->info['name'];
$current_theme['version'] = isset($theme->info['version']) ? $theme->info['version'] : '';
$current_theme['notes'] = $theme->notes;
$current_theme['is_default'] = $theme->is_default;
$current_theme['is_admin'] = $theme->is_admin;
// Make sure to provide feedback on compatibility.
$current_theme['incompatible'] = '';
......
......@@ -9,14 +9,21 @@
* contain the keys 'title', 'link_path', and 'localized_options', which are
* passed to l(). A 'description' key may also be provided.
* - attributes: HTML attributes to be added to the element.
* - compact: Boolean indicating whether compact mode is turned on or not.
*
* @see template_preprocess_admin_block_content()
*
* @ingroup themeable
*/
#}
{%
set classes = [
'admin-list',
compact ? 'compact',
]
%}
{% if content %}
<dl{{ attributes }}>
<dl{{ attributes.addClass(classes) }}>
{% for item in content %}
<dt>{{ item.link }}</dt>
{% if item.description %}
......
......@@ -10,7 +10,7 @@
* - value: (optional) The requirement's status.
* - description: (optional) The requirement's description.
* - severity_title: The title of the severity.
* - severity_class: The HTML class of the severity.
* - severity_status: Indicates the severity status.
*
* @see template_preprocess_status_report()
*
......@@ -25,7 +25,7 @@
</thead>
<tbody>
{% for requirement in requirements %}
<tr class="{{ requirement.severity_class }}">
<tr class="{{ requirement.severity_status }}">
<td class="status-icon">
<div title="{{ requirement.severity_title }}">
<span class="visually-hidden">{{ requirement.severity_title }}</span>
......
......@@ -15,6 +15,10 @@
* - description: Description of the theme.
* - name: Theme name.
* - version: The theme's version number.
* - is_default: Boolean indicating whether the theme is the default theme
* or not.
* - is_admin: Boolean indicating whether the theme is the admin theme or
* not.
* - notes: Identifies what context this theme is being used in, e.g.,
* default theme, admin theme.
* - incompatible: Text describing any compatibility issues.
......@@ -28,10 +32,25 @@
#}
<div{{ attributes }}>
{% for theme_group in theme_groups %}
<div{{ theme_group.attributes }}>
{%
set theme_group_classes = [
'system-themes-list',
'system-themes-list-' ~ theme_group.state,
'clearfix',
]
%}
<div{{ theme_group.attributes.addClass(theme_group_classes) }}>
<h2>{{ theme_group.title }}</h2>
{% for theme in theme_group.themes %}
<div{{ theme.attributes }}>
{%
set theme_classes = [
theme.is_default ? 'theme-default',
theme.is_admin ? 'theme-admin',
'theme-selector',
'clearfix',
]
%}
<div{{ theme.attributes.addClass(theme_classes) }}>
{% if theme.screenshot %}
{{ theme.screenshot }}
{% endif %}
......
......@@ -11,13 +11,20 @@
* - title: Short name of the section.
* - description: Description of the administrative menu item.
* - attributes: HTML attributes to be added to the element.
* - compact: Boolean indicating whether compact mode is turned on or not.
*
* @see template_preprocess_admin_block_content()
* @see seven_preprocess_admin_block_content()
*/
#}
{%
set classes = [
'admin-list',
compact ? 'compact',
]
%}
{% if content %}
<ul{{ attributes }}>
<ul{{ attributes.addClass(classes) }}>
{% for item in content %}
<li><a href="{{ item.url }}"><span class="label">{{ item.title }}</span><div class="description">{{ item.description }}</div></a></li>
{% endfor %}
......
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