? issue-558928-form-labeling-6.patch
? patch.patch
? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.202
diff -u -p -r1.202 install.php
--- install.php	25 Aug 2009 21:53:46 -0000	1.202
+++ install.php	31 Aug 2009 19:00:28 -0000
@@ -834,6 +834,7 @@ function install_settings_form(&$form_st
       '#options' => $drivers,
       '#default_value' => !empty($database['driver']) ? $database['driver'] : current(array_keys($drivers)),
       '#description' => st('The type of database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_name())),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
     if (count($drivers) == 1) {
       $form['basic_options']['driver']['#disabled'] = TRUE;
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.368
diff -u -p -r1.368 form.inc
--- includes/form.inc	29 Aug 2009 16:30:14 -0000	1.368
+++ includes/form.inc	31 Aug 2009 19:00:29 -0000
@@ -1514,7 +1514,13 @@ function theme_select($element) {
   $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
   _form_set_class($element, array('form-select'));
   $multiple = $element['#multiple'];
-  return '<select name="' . $element['#name'] . '' . ($multiple ? '[]' : '') . '"' . ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) . ' id="' . $element['#id'] . '" ' . $size . '>' . form_select_options($element) . '</select>';
+  $title = '';
+
+  if (!empty($element['#title']) && isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_ATTRIBUTE) {
+  $title = ' title="' . $element['#title'] . '"';
+}
+
+  return '<select name="' . $element['#name'] . ($multiple ? '[]' : '') . '"' . ($multiple ? ' multiple="multiple"' : '') . $title . ' ' . drupal_attributes($element['#attributes']) . ' id="' . $element['#id'] . '" ' . $size . '>' . form_select_options($element) . '</select>';
 }
 
 /**
@@ -1654,15 +1660,19 @@ function theme_fieldset($element) {
  */
 function theme_radio($element) {
   _form_set_class($element, array('form-radio'));
+  $title = '';
+
+  if (!empty($element['#title']) && isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_ATTRIBUTE) {
+  $title = ' title="' . $element['#title'] . '"';
+}
+
   $output = '<input type="radio" ';
   $output .= 'id="' . $element['#id'] . '" ';
-  $output .= 'name="' . $element['#name'] . '" ';
+  $output .= 'name="' . $element['#name'] . '"';
+  $output .= $title . ' ';
   $output .= 'value="' . $element['#return_value'] . '" ';
   $output .= (check_plain($element['#value']) == $element['#return_value']) ? ' checked="checked" ' : ' ';
   $output .= drupal_attributes($element['#attributes']) . ' />';
-  if (!is_null($element['#title'])) {
-    $output = '<label class="option" for="' . $element['#id'] . '">' . $output . ' ' . $element['#title'] . '</label>';
-  }
 
   return $output;
 }
@@ -1990,18 +2000,21 @@ function theme_text_format_wrapper($elem
  */
 function theme_checkbox($element) {
   _form_set_class($element, array('form-checkbox'));
+  $title = '';
+
+  if (!empty($element['#title']) && isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_ATTRIBUTE) {
+  $title = ' title="' . $element['#title'] . '"';
+}
+
   $checkbox = '<input ';
   $checkbox .= 'type="checkbox" ';
   $checkbox .= 'name="' . $element['#name'] . '" ';
-  $checkbox .= 'id="' . $element['#id'] . '" ' ;
+  $checkbox .= 'id="' . $element['#id'] . '"';
+  $checkbox .= $title . ' ';
   $checkbox .= 'value="' . $element['#return_value'] . '" ';
   $checkbox .= $element['#value'] ? ' checked="checked" ' : ' ';
   $checkbox .= drupal_attributes($element['#attributes']) . ' />';
 
-  if (!is_null($element['#title'])) {
-    $checkbox = '<label class="option" for="' . $element['#id'] . '">' . $checkbox . ' ' . $element['#title'] . '</label>';
-  }
-
   return $checkbox;
 }
 
@@ -2424,6 +2437,12 @@ function theme_textfield($element) {
   $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="' . $element['#maxlength'] . '"';
   $class = array('form-text');
   $extra = '';
+  $title = '';
+
+  if (!empty($element['#title']) && isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_ATTRIBUTE) {
+  $title = ' title="' . $element['#title'] . '"';
+}
+
   $output = '';
 
   if ($element['#autocomplete_path'] && menu_valid_path(array('link_path' => $element['#autocomplete_path']))) {
@@ -2437,7 +2456,7 @@ function theme_textfield($element) {
     $output .= '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ';
   }
 
-  $output .= '<input type="text"' . $maxlength . ' name="' . $element['#name'] . '" id="' . $element['#id'] . '"' . $size . ' value="' . check_plain($element['#value']) . '"' . drupal_attributes($element['#attributes']) . ' />';
+  $output .= '<input type="text"' . $title . $maxlength . ' name="' . $element['#name'] . '" id="' . $element['#id'] . '"' . $size . ' value="' . check_plain($element['#value']) . '"' . drupal_attributes($element['#attributes']) . ' />';
 
   if (isset($element['#field_suffix'])) {
     $output .= ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>';
@@ -2476,6 +2495,11 @@ function theme_form($element) {
  */
 function theme_textarea($element) {
   $class = array('form-textarea');
+  $title = '';
+
+  if (!empty($element['#title']) && isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_ATTRIBUTE) {
+  $title = ' title="' . $element['#title'] . '"';
+}
 
   // Add resizable behavior
   if ($element['#resizable'] !== FALSE) {
@@ -2484,7 +2508,7 @@ function theme_textarea($element) {
   }
 
   _form_set_class($element, $class);
-  return '<textarea cols="' . $element['#cols'] . '" rows="' . $element['#rows'] . '" name="' . $element['#name'] . '" id="' . $element['#id'] . '" ' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
+  return '<textarea cols="' . $element['#cols'] . '" rows="' . $element['#rows'] . '" name="' . $element['#name'] . '" id="' . $element['#id'] . '"' . $title . ' ' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
 }
 
 /**
@@ -2518,9 +2542,14 @@ function theme_markup($element) {
 function theme_password($element) {
   $size = $element['#size'] ? ' size="' . $element['#size'] . '" ' : '';
   $maxlength = $element['#maxlength'] ? ' maxlength="' . $element['#maxlength'] . '" ' : '';
+  $title = '';
+
+  if (!empty($element['#title']) && isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_ATTRIBUTE) {
+  $title = ' title="' . $element['#title'] . '"';
+}
 
   _form_set_class($element, array('form-text'));
-  $output = '<input type="password" name="' . $element['#name'] . '" id="' . $element['#id'] . '" ' . $maxlength . $size . drupal_attributes($element['#attributes']) . ' />';
+  $output = '<input type="password" name="' . $element['#name'] . '" id="' . $element['#id'] . '" ' . $title . $maxlength . $size . drupal_attributes($element['#attributes']) . ' />';
   return $output;
 }
 
@@ -2554,7 +2583,13 @@ function form_process_weight($element) {
  */
 function theme_file($element) {
   _form_set_class($element, array('form-file'));
-  return '<input type="file" name="' . $element['#name'] . '"' . ($element['#attributes'] ? ' ' . drupal_attributes($element['#attributes']) : '') . ' id="' . $element['#id'] . '" size="' . $element['#size'] . "\" />\n";
+  $title = '';
+
+  if (!empty($element['#title']) && isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_ATTRIBUTE) {
+  $title = ' title="' . $element['#title'] . '"';
+}
+
+  return '<input type="file" name="' . $element['#name'] . '"' . $title . ' ' . ($element['#attributes'] ? ' ' . drupal_attributes($element['#attributes']) : '') . ' id="' . $element['#id'] . '" size="' . $element['#size'] . "\" />\n";
 }
 
 /**
@@ -2584,17 +2619,31 @@ function theme_form_element($element) {
   $output = '<div class="' . implode(' ', $class) . '">' . "\n";
   $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
 
-  if (!empty($element['#title']) && empty($element['#form_element_skip_title'])) {
+  $label = '';
+
+  if (!empty($element['#title'])) {
     $title = $element['#title'];
     if (!empty($element['#id'])) {
-      $output .= ' <label for="' . $element['#id'] . '">' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
+      $label = ' <label for="' . $element['#id'] . '">' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
     }
     else {
-      $output .= ' <label>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
+      $label= ' <label>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
     }
   }
 
-  $output .= " " . $element['#children'] . "\n";
+  if ($element['#type'] == 'item') {
+    $output .= '<h3>' . $element['#title'] . '</h3>';
+  }
+
+  if (isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_BEFORE) {
+    $output .= $label . " " . $element['#children'] . "\n";
+  }
+  else if (isset($element['#show_title']) && $element['#show_title'] == FORM_ELEMENT_SHOW_TITLE_AFTER) {
+    $output .= $element['#children'] . " " . $label . "\n";
+  }
+  else {
+    $output .= " " . $element['#children'] . "\n";
+  }
 
   if (!empty($element['#description'])) {
     $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.226
diff -u -p -r1.226 locale.inc
--- includes/locale.inc	22 Aug 2009 14:34:17 -0000	1.226
+++ includes/locale.inc	31 Aug 2009 19:00:30 -0000
@@ -55,10 +55,12 @@ function locale_languages_overview_form(
   $form['enabled'] = array('#type' => 'checkboxes',
     '#options' => $options,
     '#default_value' => $enabled,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['site_default'] = array('#type' => 'radios',
     '#options' => $options,
     '#default_value' => language_default('language'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
   $form['#theme'] = 'locale_languages_overview_form';
Index: modules/aggregator/aggregator.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.admin.inc,v
retrieving revision 1.42
diff -u -p -r1.42 aggregator.admin.inc
--- modules/aggregator/aggregator.admin.inc	24 Aug 2009 17:11:41 -0000	1.42
+++ modules/aggregator/aggregator.admin.inc	31 Aug 2009 19:00:32 -0000
@@ -266,6 +266,7 @@ function aggregator_form_opml(&$form_sta
       '#title' => t('Categorize news items'),
       '#options' => $options,
       '#description' => t('New feed items are automatically filed in the checked categories.'),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
   $form['submit'] = array(
@@ -442,6 +443,7 @@ function aggregator_admin_form($form_sta
       '#description' => t('Fetchers download data from an external source. Choose a fetcher suitable for the external source you would like to download from.'),
       '#options' => $fetchers,
       '#default_value' => variable_get('aggregator_fetcher', 'aggregator'),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
   if (count($parsers) > 1) {
@@ -451,6 +453,7 @@ function aggregator_admin_form($form_sta
       '#description' => t('Parsers transform downloaded data into standard structures. Choose a parser suitable for the type of feeds you would like to aggregate.'),
       '#options' => $parsers,
       '#default_value' => variable_get('aggregator_parser', 'aggregator'),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
   if (count($processors) > 1) {
@@ -460,6 +463,7 @@ function aggregator_admin_form($form_sta
       '#description' => t('Processors act on parsed feed data, for example they store feed items. Choose the processors suitable for your task.'),
       '#options' => $processors,
       '#default_value' => variable_get('aggregator_processors', array('aggregator')),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
   if (count($basic_conf)) {
Index: modules/block/block.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v
retrieving revision 1.54
diff -u -p -r1.54 block.admin.inc
--- modules/block/block.admin.inc	31 Aug 2009 17:06:08 -0000	1.54
+++ modules/block/block.admin.inc	31 Aug 2009 19:00:32 -0000
@@ -280,6 +280,7 @@ function block_admin_configure(&$form_st
       '#title' => t('Show block on specific pages'),
       '#options' => $options,
       '#default_value' => $edit['visibility'],
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
     $form['page_vis_settings']['pages'] = array(
       '#type' => 'textarea',
@@ -307,6 +308,7 @@ function block_admin_configure(&$form_st
     '#default_value' => $default_role_options,
     '#options' => $role_options,
     '#description' => t('Show this block only for the selected role(s). If you select no roles, the block will be visible to all users.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   // Content type specific configuration.
@@ -326,6 +328,7 @@ function block_admin_configure(&$form_st
     '#default_value' => $default_type_options,
     '#options' => node_type_get_names(),
     '#description' => t('Show this block only when on a page displaying a post of the given type(s). If you select no types, there will be no type specific limitation.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   // Standard block configurations.
@@ -345,6 +348,7 @@ function block_admin_configure(&$form_st
     ),
     '#description' => t('Allow individual users to customize the visibility of this block in their account settings.'),
     '#default_value' => $edit['custom'],
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $form['submit'] = array(
Index: modules/book/book.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.admin.inc,v
retrieving revision 1.21
diff -u -p -r1.21 book.admin.inc
--- modules/book/book.admin.inc	22 Aug 2009 14:34:18 -0000	1.21
+++ modules/book/book.admin.inc	31 Aug 2009 19:00:32 -0000
@@ -43,6 +43,7 @@ function book_admin_settings() {
     '#options' => $types,
     '#description' => t('Select content types which users with the %add-perm permission will be allowed to add to the book hierarchy. Users with the %outline-perm permission can add all content types.', array('%add-perm' => t('add content to books'),  '%outline-perm' => t('administer book outlines'))),
     '#required' => TRUE,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['book_child_type'] = array(
     '#type' => 'radios',
@@ -51,6 +52,7 @@ function book_admin_settings() {
     '#options' => $types,
     '#description' => t('The content type for the %add-child link must be one of those selected as an allowed book outline type.', array('%add-child' => t('Add child page'))),
     '#required' => TRUE,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
   $form['#validate'][] = 'book_admin_settings_validate';
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.765
diff -u -p -r1.765 comment.module
--- modules/comment/comment.module	29 Aug 2009 10:46:40 -0000	1.765
+++ modules/comment/comment.module	31 Aug 2009 19:00:33 -0000
@@ -1047,6 +1047,7 @@ function comment_form_alter(&$form, $for
         '#id' => 'edit-comment-0',
         '#parents' => array('comment'),
       ),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
     // If the node doesn't have any comments, the "hidden" option makes no
     // sense, so don't even bother presenting it to the user.
@@ -1722,6 +1723,7 @@ function comment_form(&$form_state, $com
         '#default_value' =>  $status,
         '#options' => array(t('Not published'), t('Published')),
         '#weight' => -1,
+        '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
       );
     }
     else {
Index: modules/field/modules/options/options.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/options/options.module,v
retrieving revision 1.9
diff -u -p -r1.9 options.module
--- modules/field/modules/options/options.module	27 Aug 2009 00:33:51 -0000	1.9
+++ modules/field/modules/options/options.module	31 Aug 2009 19:00:34 -0000
@@ -156,6 +156,7 @@ function options_buttons_elements_proces
     '#multiple' => $multiple,
     '#options' => $options,
     '#default_value' => $value,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   // Set #element_validate in a way that it will not wipe out other
Index: modules/field/modules/text/text.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.module,v
retrieving revision 1.25
diff -u -p -r1.25 text.module
--- modules/field/modules/text/text.module	27 Aug 2009 00:33:52 -0000	1.25
+++ modules/field/modules/text/text.module	31 Aug 2009 19:00:34 -0000
@@ -157,6 +157,7 @@ function text_field_instance_settings_fo
       t('Plain text'),
       t('Filtered text (user selects input format)'),
     ),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   if ($field['type'] == 'text_with_summary') {
     $form['display_summary'] = array(
Index: modules/field_ui/field_ui.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.api.php,v
retrieving revision 1.1
diff -u -p -r1.1 field_ui.api.php
--- modules/field_ui/field_ui.api.php	19 Aug 2009 13:31:13 -0000	1.1
+++ modules/field_ui/field_ui.api.php	31 Aug 2009 19:00:34 -0000
@@ -55,6 +55,7 @@ function hook_field_instance_settings_fo
       t('Plain text'),
       t('Filtered text (user selects input format)'),
     ),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   if ($field['type'] == 'text_with_summary') {
     $form['display_summary'] = array(
Index: modules/file/file.field.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/file/file.field.inc,v
retrieving revision 1.1
diff -u -p -r1.1 file.field.inc
--- modules/file/file.field.inc	29 Aug 2009 12:52:32 -0000	1.1
+++ modules/file/file.field.inc	31 Aug 2009 19:00:34 -0000
@@ -100,6 +100,7 @@ function file_field_settings_form($field
     '#options' => $scheme_options,
     '#default_value' => $settings['uri_scheme'],
     '#description' => t('Select where the final files should be stored. Private file storage has significantly more overhead than public files, but allows restricted access to files within this field.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $form['default_file'] = array(
@@ -451,6 +452,7 @@ function file_field_widget_settings_form
     '#description' => t('The throbber display does not show the status of uploads but takes up space. The progress bar is helpful for monitoring progress on large uploads.'),
     '#weight' => 2,
     '#access' => file_progress_implementation(),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $form['additional'] = array(
Index: modules/filter/filter.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v
retrieving revision 1.42
diff -u -p -r1.42 filter.admin.inc
--- modules/filter/filter.admin.inc	28 Aug 2009 16:23:04 -0000	1.42
+++ modules/filter/filter.admin.inc	31 Aug 2009 19:00:34 -0000
@@ -36,7 +36,7 @@ function filter_admin_overview() {
     $form[$id]['delete'] = array('#markup' => $default ? '' : l(t('delete'), 'admin/config/content/formats/delete/' . $id));
     $form[$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight);
   }
-  $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
+  $form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1), '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,);
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save changes'));
   return $form;
 }
Index: modules/forum/forum.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.admin.inc,v
retrieving revision 1.24
diff -u -p -r1.24 forum.admin.inc
--- modules/forum/forum.admin.inc	30 Jul 2009 19:24:21 -0000	1.24
+++ modules/forum/forum.admin.inc	31 Aug 2009 19:00:34 -0000
@@ -208,6 +208,7 @@ function forum_admin_settings() {
     '#default_value' => '1',
     '#options' => $forder,
     '#description' => t('Default display order for topics.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   return system_settings_form($form, TRUE);
 }
Index: modules/image/image.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/image/image.admin.inc,v
retrieving revision 1.9
diff -u -p -r1.9 image.admin.inc
--- modules/image/image.admin.inc	24 Aug 2009 00:14:20 -0000	1.9
+++ modules/image/image.admin.inc	31 Aug 2009 19:00:34 -0000
@@ -512,6 +512,7 @@ function image_crop_form($data) {
     '#theme' => 'image_anchor',
     '#default_value' => $data['anchor'],
     '#description' => t('The part of the image that will be retained during the crop.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   return $form;
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.258
diff -u -p -r1.258 locale.module
--- modules/locale/locale.module	31 Aug 2009 17:06:09 -0000	1.258
+++ modules/locale/locale.module	31 Aug 2009 19:00:35 -0000
@@ -272,6 +272,7 @@ function locale_language_selector_form($
     '#default_value' => $user_preferred_language->language,
     '#options' => $names,
     '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? t("This account's default language for e-mails, and preferred language for site presentation.") : t("This account's default language for e-mails."),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   return $form;
 }
@@ -301,6 +302,7 @@ function locale_form_node_type_form_alte
       '#default_value' => variable_get('language_content_type_' . $form['#node_type']->type, 0),
       '#options' => array(t('Disabled'), t('Enabled')),
       '#description' => t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language'))),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
 }
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.91
diff -u -p -r1.91 content_types.inc
--- modules/node/content_types.inc	24 Aug 2009 19:26:46 -0000	1.91
+++ modules/node/content_types.inc	31 Aug 2009 19:00:35 -0000
@@ -155,7 +155,8 @@ function node_type_form(&$form_state, $t
       DRUPAL_OPTIONAL => t('Optional'),
       DRUPAL_REQUIRED => t('Required'),
     ),
-    );
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
+  );
   $form['submission']['help']  = array(
     '#type' => 'textarea',
     '#title' => t('Explanation or submission guidelines'),
@@ -179,6 +180,7 @@ function node_type_form(&$form_state, $t
       'revision' => t('Create new revision'),
     ),
     '#description' => t('Users with the <em>administer nodes</em> permission will be able to override these options.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['display'] = array(
     '#type' => 'fieldset',
Index: modules/node/node.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v
retrieving revision 1.64
diff -u -p -r1.64 node.admin.inc
--- modules/node/node.admin.inc	25 Aug 2009 10:27:14 -0000	1.64
+++ modules/node/node.admin.inc	31 Aug 2009 19:00:35 -0000
@@ -460,6 +460,7 @@ function node_admin_nodes() {
   $form['nodes'] = array(
     '#type' => 'checkboxes',
     '#options' => $nodes,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['pager'] = array('#markup' => theme('pager', NULL));
   $form['#theme'] = 'node_admin_nodes';
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1117
diff -u -p -r1.1117 node.module
--- modules/node/node.module	31 Aug 2009 17:06:09 -0000	1.1117
+++ modules/node/node.module	31 Aug 2009 19:00:36 -0000
@@ -2027,6 +2027,7 @@ function node_form_search_form_alter(&$f
       '#prefix' => '<div class="criterion">',
       '#suffix' => '</div>',
       '#options' => $types,
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
     $form['advanced']['submit'] = array(
       '#type' => 'submit',
@@ -2047,6 +2048,7 @@ function node_form_search_form_alter(&$f
         '#prefix' => '<div class="criterion">',
         '#suffix' => '</div>',
         '#options' => $language_options,
+        '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
       );
     }
 
Index: modules/poll/poll.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v
retrieving revision 1.311
diff -u -p -r1.311 poll.module
--- modules/poll/poll.module	29 Aug 2009 05:46:03 -0000	1.311
+++ modules/poll/poll.module	31 Aug 2009 19:00:36 -0000
@@ -307,6 +307,7 @@ function poll_form($node, $form_state) {
     '#options' => $active,
     '#description' => t('When a poll is closed, visitors can no longer vote for it.'),
     '#access' => $admin,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['settings']['runtime'] = array(
     '#type' => 'select',
@@ -638,6 +639,7 @@ function poll_view_voting(&$form_state, 
       '#type' => 'radios',
       '#default_value' => -1,
       '#options' => $list,
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
 
Index: modules/profile/profile.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.admin.inc,v
retrieving revision 1.29
diff -u -p -r1.29 profile.admin.inc
--- modules/profile/profile.admin.inc	22 Aug 2009 14:34:21 -0000	1.29
+++ modules/profile/profile.admin.inc	31 Aug 2009 19:00:36 -0000
@@ -252,6 +252,7 @@ Unless you know what you are doing, it i
     '#title' => t('Visibility'),
     '#default_value' => isset($edit['visibility']) ? $edit['visibility'] : PROFILE_PUBLIC,
     '#options' => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   if ($type == 'selection' || $type == 'list' || $type == 'textfield') {
     $form['fields']['page'] = array('#type' => 'textfield',
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.273
diff -u -p -r1.273 profile.module
--- modules/profile/profile.module	31 Aug 2009 17:06:09 -0000	1.273
+++ modules/profile/profile.module	31 Aug 2009 19:00:36 -0000
@@ -158,6 +158,7 @@ function profile_block_configure($delta 
     '#default_value' => variable_get('profile_block_author_fields', array()),
     '#options' => $fields,
     '#description' => t('Select which profile fields you wish to display in the block. Only fields designated as public in the <a href="@profile-admin">profile field configuration</a> are available.', array('@profile-admin' => url('admin/config/people/profile'))),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   return $form;
 }
Index: modules/search/search.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.admin.inc,v
retrieving revision 1.11
diff -u -p -r1.11 search.admin.inc
--- modules/search/search.admin.inc	29 Aug 2009 21:05:16 -0000	1.11
+++ modules/search/search.admin.inc	31 Aug 2009 19:00:36 -0000
@@ -115,7 +115,8 @@ function search_admin_settings() {
     '#title' => t('Active search modules'),
     '#default_value' => array('node', 'user'),
     '#options' => _search_get_module_names(),
-    '#description' => t('Determine which search modules are active from the available modules.')
+    '#description' => t('Determine which search modules are active from the available modules.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $form['#submit'][] = 'search_admin_settings_submit';
Index: modules/simpletest/tests/form_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/form_test.module,v
retrieving revision 1.8
diff -u -p -r1.8 form_test.module
--- modules/simpletest/tests/form_test.module	17 Aug 2009 07:12:16 -0000	1.8
+++ modules/simpletest/tests/form_test.module	31 Aug 2009 19:00:38 -0000
@@ -87,6 +87,7 @@ function form_test_test_form(&$form_stat
     '#type' => 'item',
     '#title' => 'Test Textfield',
     '#markup' => form_clean_id('form_test_form_clean_id_presence'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   return $form;
 }
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.197
diff -u -p -r1.197 system.admin.inc
--- modules/system/system.admin.inc	26 Aug 2009 10:53:45 -0000	1.197
+++ modules/system/system.admin.inc	31 Aug 2009 19:00:38 -0000
@@ -262,11 +262,13 @@ function system_themes_form() {
     '#default_value' => $status,
     '#incompatible_themes_core' => drupal_map_assoc($incompatible_core),
     '#incompatible_themes_php' => $incompatible_php,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['theme_default'] = array(
     '#type' => 'radios',
     '#options' => array_fill_keys(array_keys($options), ''),
     '#default_value' => variable_get('theme_default', 'garland'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   // Administration theme settings.
@@ -1066,6 +1068,7 @@ function system_modules_uninstall($form_
     $form['uninstall'] = array(
       '#type' => 'checkboxes',
       '#options' => $options,
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
     $form['buttons']['submit'] = array(
       '#type' => 'submit',
@@ -1365,6 +1368,7 @@ function system_logging_settings() {
       ERROR_REPORTING_DISPLAY_SOME => t('Errors and warnings'),
       ERROR_REPORTING_DISPLAY_ALL => t('All messages'),
     ),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   return system_settings_form($form);
@@ -1401,6 +1405,7 @@ function system_performance_settings() {
     '#title' => t('Page cache for anonymous users'),
     '#default_value' => $cache,
     '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended)')),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval');
   $period[0] = '<' . t('none') . '>';
@@ -1511,6 +1516,7 @@ function system_file_system_settings() {
     '#default_value' => 'public',
     '#options' => $options,
     '#description' => t('This setting is used as the preferred download method. The use of public files is more efficient, but does not provide any access control.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   return system_settings_form($form, TRUE);
@@ -1539,7 +1545,8 @@ function system_image_toolkit_settings()
       '#type' => 'radios',
       '#title' => t('Select an image processing toolkit'),
       '#default_value' => $current_toolkit,
-      '#options' => $toolkits_available
+      '#options' => $toolkits_available,
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
   else {
@@ -1692,7 +1699,8 @@ function system_regional_settings() {
       DRUPAL_USER_TIMEZONE_EMPTY   => t('Empty time zone.'),
       DRUPAL_USER_TIMEZONE_SELECT  => t('Users may set their own time zone at registration.'),
     ),
-    '#description' => t('Only applied if users may set their own time zone.')
+    '#description' => t('Only applied if users may set their own time zone.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $form['date_formats'] = array(
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.70
diff -u -p -r1.70 system.api.php
--- modules/system/system.api.php	31 Aug 2009 17:45:04 -0000	1.70
+++ modules/system/system.api.php	31 Aug 2009 19:00:38 -0000
@@ -515,6 +515,7 @@ function hook_form_alter(&$form, &$form_
       '#title' => t('Attachments'),
       '#default_value' => variable_get('upload_' . $form['type']['#value'], 1),
       '#options' => array(t('Disabled'), t('Enabled')),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
 }
Index: modules/system/system.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.css,v
retrieving revision 1.61
diff -u -p -r1.61 system.css
--- modules/system/system.css	24 Aug 2009 03:11:34 -0000	1.61
+++ modules/system/system.css	31 Aug 2009 19:00:38 -0000
@@ -139,7 +139,9 @@ tr.merge-up, tr.merge-up td, tr.merge-up
   display: block;
   font-weight: bold;
 }
-.form-item label.option {
+.form-item label.option,
+.form-type-checkbox label,
+.form-type-radio label {
   display: inline;
   font-weight: normal;
 }
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.783
diff -u -p -r1.783 system.module
--- modules/system/system.module	31 Aug 2009 17:06:10 -0000	1.783
+++ modules/system/system.module	31 Aug 2009 19:00:39 -0000
@@ -88,6 +88,25 @@ define('REGIONS_ALL', 'all');
 
 
 /**
+ *
+ * Output form element titles as labels before form elements. @see system_elements().
+ */
+define('FORM_ELEMENT_SHOW_TITLE_BEFORE', 'before');
+
+/**
+ *
+ * Output form element titles as labels after form elements. @see system_elements().
+ */
+define('FORM_ELEMENT_SHOW_TITLE_AFTER', 'after');
+
+/**
+ *
+ * Output form element titles as the title attribute of form elements. @see system_elements().
+ */
+define('FORM_ELEMENT_SHOW_TITLE_ATTRIBUTE', 'attribute');
+
+
+/**
  * Implement hook_help().
  */
 function system_help($path, $arg) {
@@ -341,6 +360,7 @@ function system_elements() {
     '#process' => array('form_process_text_format', 'ajax_process_form'),
     '#theme' => 'textfield',
     '#theme_wrappers' => array('form_element'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $type['password'] = array(
@@ -350,12 +370,14 @@ function system_elements() {
     '#process' => array('ajax_process_form'),
     '#theme' => 'password',
     '#theme_wrappers' => array('form_element'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $type['password_confirm'] = array(
     '#input' => TRUE,
     '#process' => array('form_process_password_confirm'),
     '#theme_wrappers' => array('form_element'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $type['textarea'] = array(
@@ -366,6 +388,7 @@ function system_elements() {
     '#process' => array('form_process_text_format', 'ajax_process_form'),
     '#theme' => 'textarea',
     '#theme_wrappers' => array('form_element'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $type['radios'] = array(
@@ -381,7 +404,7 @@ function system_elements() {
     '#process' => array('ajax_process_form'),
     '#theme' => 'radio',
     '#theme_wrappers' => array('form_element'),
-    '#form_element_skip_title' => TRUE,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_AFTER,
   );
 
   $type['checkboxes'] = array(
@@ -398,7 +421,7 @@ function system_elements() {
     '#process' => array('ajax_process_form'),
     '#theme' => 'checkbox',
     '#theme_wrappers' => array('form_element'),
-    '#form_element_skip_title' => TRUE,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_AFTER,
   );
 
   $type['select'] = array(
@@ -408,6 +431,7 @@ function system_elements() {
     '#process' => array('ajax_process_form'),
     '#theme' => 'select',
     '#theme_wrappers' => array('form_element'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $type['weight'] = array(
@@ -430,6 +454,7 @@ function system_elements() {
     '#size' => 60,
     '#theme' => 'file',
     '#theme_wrappers' => array('form_element'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $type['tableselect'] = array(
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.66
diff -u -p -r1.66 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	23 Aug 2009 01:05:12 -0000	1.66
+++ modules/taxonomy/taxonomy.admin.inc	31 Aug 2009 19:00:39 -0000
@@ -157,6 +157,7 @@ function taxonomy_form_vocabulary(&$form
     '#title' => t('Apply to content types'),
     '#default_value' => $edit['nodes'],
     '#options' => array_map('check_plain', node_type_get_names()),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['settings'] = array(
     '#type' => 'fieldset',
Index: modules/update/update.settings.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.settings.inc,v
retrieving revision 1.8
diff -u -p -r1.8 update.settings.inc
--- modules/update/update.settings.inc	24 Aug 2009 00:42:34 -0000	1.8
+++ modules/update/update.settings.inc	31 Aug 2009 19:00:40 -0000
@@ -30,6 +30,7 @@ function update_settings() {
       '7' => t('Weekly'),
     ),
     '#description' => t('Select how frequently you want to automatically check for new releases of your currently installed modules and themes.'),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $form['update_notification_threshold'] = array(
@@ -40,7 +41,8 @@ function update_settings() {
       'all' => t('All newer versions'),
       'security' => t('Only security updates'),
     ),
-    '#description' => t('You can choose to send e-mail only if a security update is available, or to be notified about all newer versions. If there are updates available of Drupal core or any of your installed modules and themes, your site will always print a message on the <a href="@status_report">status report</a> page, and will also display an error message on administration pages if there is a security update.', array('@status_report' => url('admin/reports/status')))
+    '#description' => t('You can choose to send e-mail only if a security update is available, or to be notified about all newer versions. If there are updates available of Drupal core or any of your installed modules and themes, your site will always print a message on the <a href="@status_report">status report</a> page, and will also display an error message on administration pages if there is a security update.', array('@status_report' => url('admin/reports/status'))),
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
 
   $form['update_check_disabled'] = array(
Index: modules/upload/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v
retrieving revision 1.256
diff -u -p -r1.256 upload.module
--- modules/upload/upload.module	24 Aug 2009 00:14:22 -0000	1.256
+++ modules/upload/upload.module	31 Aug 2009 19:00:40 -0000
@@ -217,6 +217,7 @@ function upload_form_alter(&$form, $form
       '#title' => t('Attachments'),
       '#default_value' => variable_get('upload_' . $form['#node_type']->type, 1),
       '#options' => array(t('Disabled'), t('Enabled')),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
 
Index: modules/user/user.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v
retrieving revision 1.76
diff -u -p -r1.76 user.admin.inc
--- modules/user/user.admin.inc	27 Aug 2009 20:25:28 -0000	1.76
+++ modules/user/user.admin.inc	31 Aug 2009 19:00:40 -0000
@@ -66,6 +66,7 @@ function user_filter_form() {
   $form['filters']['filter'] = array(
     '#type' => 'radios',
     '#options' => $names,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['filters']['buttons']['submit'] = array(
     '#type' => 'submit',
@@ -195,7 +196,8 @@ function user_admin_account() {
   }
   $form['accounts'] = array(
     '#type' => 'checkboxes',
-    '#options' => $accounts
+    '#options' => $accounts,
+    '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
   );
   $form['pager'] = array('#markup' => theme('pager', NULL));
 
@@ -285,6 +287,7 @@ function user_admin_settings() {
       t('Administrators only'),
       t('Visitors'),
       t('Visitors, but administrator approval is required'),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     )
   );
   $form['registration_cancellation']['user_email_verification'] = array(
@@ -646,7 +649,7 @@ function user_admin_permissions($form_st
 
   // Have to build checkboxes here after checkbox arrays are built
   foreach ($role_names as $rid => $name) {
-    $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => isset($status[$rid]) ? $status[$rid] : array());
+    $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => isset($status[$rid]) ? $status[$rid] : array(), '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE);
     $form['role_names'][$rid] = array('#markup' => $name, '#tree' => TRUE);
   }
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));
@@ -693,7 +696,7 @@ function theme_user_admin_permissions($f
         'class' => array('permission'),
       );
       foreach (element_children($form['checkboxes']) as $rid) {
-        $row[] = array('data' => drupal_render($form['checkboxes'][$rid][$key]), 'class' => array('checkbox'), 'title' => $roles[$rid] . ' : ' . t($key));
+        $row[] = array('data' => drupal_render($form['checkboxes'][$rid][$key]), 'class' => array('checkbox'), 'title' => $roles[$rid] . ' : ' . t($key), '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE);
       }
     }
     $rows[] = $row;
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1037
diff -u -p -r1.1037 user.module
--- modules/user/user.module	31 Aug 2009 17:06:10 -0000	1.1037
+++ modules/user/user.module	31 Aug 2009 19:00:40 -0000
@@ -1878,7 +1878,8 @@ function user_edit_form(&$form_state, $u
       '#type' => 'radios',
       '#title' => t('Status'),
       '#default_value' => isset($edit['status']) ? $edit['status'] : 1,
-      '#options' => array(t('Blocked'), t('Active'))
+      '#options' => array(t('Blocked'), t('Active')),
+      '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
     );
   }
   if (user_access('administer permissions')) {
@@ -1905,6 +1906,7 @@ function user_edit_form(&$form_state, $u
         '#default_value' => $default,
         '#options' => $roles,
         DRUPAL_AUTHENTICATED_RID => $checkbox_authenticated,
+        '#show_title' => FORM_ELEMENT_SHOW_TITLE_BEFORE,
       );
     }
   }
