1 system.theme.inc | theme_system_themes_page($variables) |
Returns HTML for the Appearance page.
Parameters
$variables: An associative array containing:
- theme_groups: An associative array containing groups of themes.
Related topics
File
- core/
modules/ system/ system.theme.inc, line 86 - Theme functions for the System module.
Code
function theme_system_themes_page($variables) {
$theme_groups = $variables['theme_groups'];
$output = '<div id="system-themes-page">';
foreach ($variables['theme_group_titles'] as $state => $title) {
if (!count($theme_groups[$state])) {
// Skip this group of themes if no theme is there.
continue;
}
// Start new theme group.
$output .= '<div class="system-themes-list system-themes-list-' . $state . ' clearfix"><h2>' . $title . '</h2>';
foreach ($theme_groups[$state] as $theme) {
// Theme the screenshot.
$screenshot = $theme->screenshot ? theme('image', $theme->screenshot) : '<div class="no-screenshot">' . t('no screenshot') . '</div>';
// Localize the theme description.
$description = t($theme->info['description']);
$prefix = '';
$depends = '';
if (isset($theme->info['base theme'])) {
$base_theme_name = $theme->info['base theme'];
$base_theme_label = !empty($theme->base_themes[$base_theme_name]) ? $theme->base_themes[$base_theme_name] : $base_theme_name;
$depends = '<br><strong>' . t('Base theme') . ':</strong> ' . check_plain($base_theme_label);
if (isset($theme->missing_dependencies)) {
$theme->classes[] = 'missing-dependency';
$icon = icon('warning', array(
'attributes' => array('width' => 24, 'height' => 24),
));
$prefix = '<div class="missing-warning">' . $icon . ' ' . t('Missing dependency') . '</div>';
if (in_array($base_theme_name, $theme->missing_dependencies)) {
$depends .= ' <em>(' . t('missing') . ')</em>';
}
}
}
// Style theme info
$notes = count($theme->notes) ? ' (' . join(', ', $theme->notes) . ')' : '';
$theme->classes[] = 'theme-selector';
$theme->classes[] = 'clearfix';
$output .= '<div class="' . join(' ', $theme->classes) . '">' . $screenshot . '<div class="theme-info"><h3>' . $theme->info['name'] . ' ' . (isset($theme->info['version']) ? $theme->info['version'] : '') . $notes . '</h3><div class="theme-description">' . $prefix . $description . $depends . '</div>';
// Make sure to provide feedback on compatibility.
if (!empty($theme->incompatible_core)) {
$output .= '<div class="incompatible">' . t('This version is not compatible with Backdrop CMS !core_version.', array('!core_version' => BACKDROP_CORE_COMPATIBILITY)) . '</div>';
}
elseif (!empty($theme->incompatible_php)) {
if (substr_count($theme->info['php'], '.') < 2) {
$theme->info['php'] .= '.*';
}
$output .= '<div class="incompatible">' . t('This theme requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $theme->info['php'], '!php_version' => phpversion())) . '</div>';
}
else {
$output .= theme('links', array('links' => $theme->operations, 'attributes' => array('class' => array('operations', 'clearfix'))));
}
$output .= '</div></div>';
}
$output .= '</div>';
}
$output .= '</div>';
return $output;
}