summaryrefslogtreecommitdiff
path: root/modules/system/system.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-08-18 22:07:14 +0000
committerDries Buytaert <dries@buytaert.net>2005-08-18 22:07:14 +0000
commit1836d3b3656f77a2e98ffdcd4d04e45410c3897f (patch)
tree7bcc4744fc44a727f0dac6fd1fe7dea6f645a4d2 /modules/system/system.module
parent97bc92f6b9a542b7f35ac230e0f3840127cbdef3 (diff)
downloadbrdo-1836d3b3656f77a2e98ffdcd4d04e45410c3897f.tar.gz
brdo-1836d3b3656f77a2e98ffdcd4d04e45410c3897f.tar.bz2
- Patch #29002 by Neil: list_themes() currently returns all themes, not just enabled themes. This functionality is only used in one place- configuration for disabled themes. These configuration pages can be removed with a usability improvement since you shouldn't be able to configure things which are disabled. Additionally, this allows us to remove some extra logic in system_user(). And it it more consistent with the module API which only lists enabled modules.
list_themes() sorts the results by name. This uses filesort in MySQL since there aren't any indexes. Sorting is not used except in system_user(). This one use can be handled with ksort since it is not often executed (only on the user edit screen when multiple themes are enabled). And a one line fix to remove a variable in system_user() is in here too.
Diffstat (limited to 'modules/system/system.module')
-rw-r--r--modules/system/system.module15
1 files changed, 4 insertions, 11 deletions
diff --git a/modules/system/system.module b/modules/system/system.module
index 164732c47..5b9864f9b 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -126,14 +126,8 @@ function system_test() {
*/
function system_user($type, $edit, &$user, $category = NULL) {
if ($type == 'form' && $category == 'account') {
- $allthemes = list_themes();
-
- // list only active themes
- foreach ($allthemes as $key => $theme) {
- if ($theme->status) {
- $themes[$key] = $theme;
- }
- }
+ $themes = list_themes();
+ ksort($themes);
if (count($themes) > 1) {
$rows = array();
@@ -145,8 +139,7 @@ function system_user($type, $edit, &$user, $category = NULL) {
$row[] = file_exists($screenshot) ? theme('image', $screenshot, t('Screenshot for %theme theme', array('%theme' => $value->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
// Information field.
- $field = '<strong>'. $value->name .'</strong>';
- $row[] = $field;
+ $row[] = '<strong>'. $value->name .'</strong>';
// Reset to follow site default theme if user selects the site default
if ($key == variable_get('theme_default', 'bluemarine')) {
@@ -485,7 +478,7 @@ function system_theme_listing() {
// enabled, default, and operations columns
$row[] = array('data' => form_checkbox('', 'status]['. $info->name, 1, $info->status), 'align' => 'center');
$row[] = array('data' => form_radio('', 'theme_default', $info->name, (variable_get('theme_default', 'bluemarine') == $info->name) ? 1 : 0), 'align' => 'center');
- if (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features')) {
+ if ($info->status && (function_exists($info->prefix . '_settings') || function_exists($info->prefix . '_features'))) {
$row[] = array('data' => l(t('configure'), 'admin/themes/settings/' . $info->name), 'align' => 'center');
}
else {