From 02f6a3ee2dfecd5743d0c3e06ef43b1941b7a424 Mon Sep 17 00:00:00 2001
From: Steven Wittens <steven@10.no-reply.drupal.org>
Date: Tue, 4 Apr 2006 23:36:18 +0000
Subject: [PATCH] #56709: Expose hidden 'toggle_logo' variable and rearrange
 theme toggles.

---
 misc/drupal.css                               |  11 ++
 modules/system.module                         | 118 ++++++++++--------
 modules/system/system.module                  | 118 ++++++++++--------
 themes/chameleon/chameleon.theme              |   2 +-
 themes/engines/phptemplate/phptemplate.engine |   2 +-
 5 files changed, 151 insertions(+), 100 deletions(-)

diff --git a/misc/drupal.css b/misc/drupal.css
index 8f71aeac7082..2421dbbd1250 100644
--- a/misc/drupal.css
+++ b/misc/drupal.css
@@ -452,6 +452,17 @@ img.screenshot {
 #tracker table {
   width: 100%;
 }
+.theme-settings-left {
+  float: left;
+  width: 49%;
+}
+.theme-settings-right {
+  float: right;
+  width: 49%;
+}
+.theme-settings-bottom {
+  clear: both;
+}
 #user-login-form {
   text-align: center;
 }
diff --git a/modules/system.module b/modules/system.module
index cb79dfd0dbaa..ae7d2580d050 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -1054,6 +1054,7 @@ function system_theme_settings($key = '') {
       if ($file = file_save_upload('logo_upload', $filename, 1)) {
         $_POST['edit']['default_logo'] = 0;
         $_POST['edit']['logo_path'] = $file->filepath;
+        $_POST['edit']['toggle_logo'] = 1;
       }
     }
     else {
@@ -1069,13 +1070,79 @@ function system_theme_settings($key = '') {
     if ($file = file_save_upload('favicon_upload', $filename, 1)) {
       $_POST['edit']['default_favicon'] = 0;
       $_POST['edit']['favicon_path'] = $file->filepath;
+      $_POST['edit']['toggle_favicon'] = 1;
     }
   }
 
+  // Toggle settings
+  $toggles = array(
+    'toggle_logo'                 => t('Logo'),
+    'toggle_name'                 => t('Site name'),
+    'toggle_slogan'               => t('Site slogan'),
+    'toggle_mission'              => t('Mission statement'),
+    'toggle_node_user_picture'    => t('User pictures in posts'),
+    'toggle_comment_user_picture' => t('User pictures in comments'),
+    'toggle_search'               => t('Search box'),
+    'toggle_favicon'              => t('Shortcut icon')
+  );
+
+  // Some features are not always available
+  $disabled = array();
+  if (!variable_get('user_pictures', 0)) {
+    $disabled['toggle_node_user_picture'] = true;
+    $disabled['toggle_comment_user_picture'] = true;
+  }
+  if (!module_exist('search')) {
+    $disabled['toggle_search'] = true;
+  }
+
+  $form['theme_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Toggle display'),
+    '#description' => t('Enable or disable the display of certain page elements.'),
+  );
+  foreach ($toggles as $name => $title) {
+    if ((!$key) || in_array($name, $features)) {
+      // disable search box if search.module is disabled
+      $form['theme_settings'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name]);
+      if (isset($disabled[$name])) {
+        $form['theme_settings'][$name]['#attributes'] = array('disabled' => 'disabled');
+      }
+    }
+  }
+
+  // System wide only settings.
+  if (!$key) {
+    // Create neat 2-column layout for the toggles
+    $form['theme_settings'] += array(
+      '#prefix' => '<div class="theme-settings-left">',
+      '#suffix' => '</div>',
+    );
+
+    // Toggle node display.
+    $node_types = module_invoke('node', 'get_types');
+    if ($node_types) {
+      $form['node_info'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Display post information on'),
+        '#description' =>  t('Enable or disable the <em>submitted by Username on date</em> text when displaying posts of the following type.'),
+        '#prefix' => '<div class="theme-settings-right">',
+        '#suffix' => '</div>',
+      );
+      foreach ($node_types as $type => $name) {
+        $form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
+      }
+    }
+  }
 
   // Logo settings
-  if ((!$key) || in_array('logo', $features)) {
-    $form['logo'] = array('#type' => 'fieldset', '#title' => t('Logo image settings'));
+  if ((!$key) || in_array('toggle_logo', $features)) {
+    $form['logo'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Logo image settings'),
+      '#description' => t('If toggled on, the following logo will be displayed.'),
+      '#attributes' => array('class' => 'theme-settings-bottom'),
+    );
     $form['logo']["default_logo"] = array(
       '#type' => 'checkbox',
       '#title' => t('Use the default logo'),
@@ -1121,53 +1188,6 @@ function system_theme_settings($key = '') {
     );
   }
 
-  // System wide only settings.
-  if (!$key) {
-    // Toggle node display.
-    $node_types = module_invoke('node', 'get_types');
-    if ($node_types) {
-      $group = '';
-      $form['node_info'] = array('#type' => 'fieldset', '#title' => t('Display post information on'), '#description' =>  t('Enable or disable the "submitted by Username on date" text when displaying posts of the above type'));
-      foreach ($node_types as $type => $name) {
-        $form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
-      }
-    }
-  }
-
-  $group = '';
-
-  // Toggle settings
-  $toggles = array(
-    'toggle_name'                 => t('Site name'),
-    'toggle_slogan'               => t('Site slogan'),
-    'toggle_mission'              => t('Mission statement'),
-    'toggle_node_user_picture'    => t('User pictures in posts'),
-    'toggle_comment_user_picture' => t('User pictures in comments'),
-    'toggle_search'               => t('Search box'),
-    'toggle_favicon'              => t('Shortcut icon')
-  );
-
-  // Some features are not always available
-  $disabled = array();
-  if (!variable_get('user_pictures', 0)) {
-    $disabled['toggle_node_user_picture'] = true;
-    $disabled['toggle_comment_user_picture'] = true;
-  }
-  if (!module_exist('search')) {
-    $disabled['toggle_search'] = true;
-  }
-
-  $form['theme_settings'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'));
-  foreach ($toggles as $name => $title) {
-    if ((!$key) || in_array($name, $features)) {
-      // disable search box if search.module is disabled
-      $form['theme_settings'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name]);
-      if (isset($disabled[$name])) {
-        $form['theme_settings'][$name]['#attributes'] = array('disabled' => 'disabled');
-      }
-    }
-  }
-
   if ($key) {
     // Template-specific settings
     $function = $themes[$key]->prefix .'_settings';
diff --git a/modules/system/system.module b/modules/system/system.module
index cb79dfd0dbaa..ae7d2580d050 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1054,6 +1054,7 @@ function system_theme_settings($key = '') {
       if ($file = file_save_upload('logo_upload', $filename, 1)) {
         $_POST['edit']['default_logo'] = 0;
         $_POST['edit']['logo_path'] = $file->filepath;
+        $_POST['edit']['toggle_logo'] = 1;
       }
     }
     else {
@@ -1069,13 +1070,79 @@ function system_theme_settings($key = '') {
     if ($file = file_save_upload('favicon_upload', $filename, 1)) {
       $_POST['edit']['default_favicon'] = 0;
       $_POST['edit']['favicon_path'] = $file->filepath;
+      $_POST['edit']['toggle_favicon'] = 1;
     }
   }
 
+  // Toggle settings
+  $toggles = array(
+    'toggle_logo'                 => t('Logo'),
+    'toggle_name'                 => t('Site name'),
+    'toggle_slogan'               => t('Site slogan'),
+    'toggle_mission'              => t('Mission statement'),
+    'toggle_node_user_picture'    => t('User pictures in posts'),
+    'toggle_comment_user_picture' => t('User pictures in comments'),
+    'toggle_search'               => t('Search box'),
+    'toggle_favicon'              => t('Shortcut icon')
+  );
+
+  // Some features are not always available
+  $disabled = array();
+  if (!variable_get('user_pictures', 0)) {
+    $disabled['toggle_node_user_picture'] = true;
+    $disabled['toggle_comment_user_picture'] = true;
+  }
+  if (!module_exist('search')) {
+    $disabled['toggle_search'] = true;
+  }
+
+  $form['theme_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Toggle display'),
+    '#description' => t('Enable or disable the display of certain page elements.'),
+  );
+  foreach ($toggles as $name => $title) {
+    if ((!$key) || in_array($name, $features)) {
+      // disable search box if search.module is disabled
+      $form['theme_settings'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name]);
+      if (isset($disabled[$name])) {
+        $form['theme_settings'][$name]['#attributes'] = array('disabled' => 'disabled');
+      }
+    }
+  }
+
+  // System wide only settings.
+  if (!$key) {
+    // Create neat 2-column layout for the toggles
+    $form['theme_settings'] += array(
+      '#prefix' => '<div class="theme-settings-left">',
+      '#suffix' => '</div>',
+    );
+
+    // Toggle node display.
+    $node_types = module_invoke('node', 'get_types');
+    if ($node_types) {
+      $form['node_info'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Display post information on'),
+        '#description' =>  t('Enable or disable the <em>submitted by Username on date</em> text when displaying posts of the following type.'),
+        '#prefix' => '<div class="theme-settings-right">',
+        '#suffix' => '</div>',
+      );
+      foreach ($node_types as $type => $name) {
+        $form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
+      }
+    }
+  }
 
   // Logo settings
-  if ((!$key) || in_array('logo', $features)) {
-    $form['logo'] = array('#type' => 'fieldset', '#title' => t('Logo image settings'));
+  if ((!$key) || in_array('toggle_logo', $features)) {
+    $form['logo'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Logo image settings'),
+      '#description' => t('If toggled on, the following logo will be displayed.'),
+      '#attributes' => array('class' => 'theme-settings-bottom'),
+    );
     $form['logo']["default_logo"] = array(
       '#type' => 'checkbox',
       '#title' => t('Use the default logo'),
@@ -1121,53 +1188,6 @@ function system_theme_settings($key = '') {
     );
   }
 
-  // System wide only settings.
-  if (!$key) {
-    // Toggle node display.
-    $node_types = module_invoke('node', 'get_types');
-    if ($node_types) {
-      $group = '';
-      $form['node_info'] = array('#type' => 'fieldset', '#title' => t('Display post information on'), '#description' =>  t('Enable or disable the "submitted by Username on date" text when displaying posts of the above type'));
-      foreach ($node_types as $type => $name) {
-        $form['node_info']["toggle_node_info_$type"] = array('#type' => 'checkbox', '#title' => $name, '#default_value' => $settings["toggle_node_info_$type"]);
-      }
-    }
-  }
-
-  $group = '';
-
-  // Toggle settings
-  $toggles = array(
-    'toggle_name'                 => t('Site name'),
-    'toggle_slogan'               => t('Site slogan'),
-    'toggle_mission'              => t('Mission statement'),
-    'toggle_node_user_picture'    => t('User pictures in posts'),
-    'toggle_comment_user_picture' => t('User pictures in comments'),
-    'toggle_search'               => t('Search box'),
-    'toggle_favicon'              => t('Shortcut icon')
-  );
-
-  // Some features are not always available
-  $disabled = array();
-  if (!variable_get('user_pictures', 0)) {
-    $disabled['toggle_node_user_picture'] = true;
-    $disabled['toggle_comment_user_picture'] = true;
-  }
-  if (!module_exist('search')) {
-    $disabled['toggle_search'] = true;
-  }
-
-  $form['theme_settings'] = array('#type' => 'fieldset', '#title' => t('Toggle display'), '#description' => t('Enable or disable the display of certain page elements.'));
-  foreach ($toggles as $name => $title) {
-    if ((!$key) || in_array($name, $features)) {
-      // disable search box if search.module is disabled
-      $form['theme_settings'][$name] = array('#type' => 'checkbox', '#title' => $title, '#default_value' => $settings[$name]);
-      if (isset($disabled[$name])) {
-        $form['theme_settings'][$name]['#attributes'] = array('disabled' => 'disabled');
-      }
-    }
-  }
-
   if ($key) {
     // Template-specific settings
     $function = $themes[$key]->prefix .'_settings';
diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme
index 3753e3b28e85..244e6a541b17 100644
--- a/themes/chameleon/chameleon.theme
+++ b/themes/chameleon/chameleon.theme
@@ -8,7 +8,7 @@
 
 function chameleon_features() {
   return array(
-       'logo',
+       'toggle_logo',
        'toggle_favicon',
        'toggle_name',
        'toggle_slogan');
diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine
index ebc18e9cdf34..97c95adc9600 100644
--- a/themes/engines/phptemplate/phptemplate.engine
+++ b/themes/engines/phptemplate/phptemplate.engine
@@ -124,7 +124,7 @@ function _phptemplate_default_variables($hook, $variables) {
  */
 function phptemplate_features() {
   return array(
-    'logo',
+    'toggle_logo',
     'toggle_comment_user_picture',
     'toggle_favicon',
     'toggle_mission',
-- 
GitLab