Index: form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.343
diff -u -p -r1.343 form.inc
--- form.inc	20 Jun 2009 15:17:38 -0000	1.343
+++ form.inc	27 Jun 2009 15:10:46 -0000
@@ -2040,6 +2040,35 @@ function form_process_ahah($element) {
 }
 
 /**
+ * Prepares a textfield_expandable element for making it expandable by javascript.
+ * Elements stored in $element['#children'] will be hidden by default when js is enabled
+ * The value(s) if the hidden element(s) will be placed behind the textfield element acompanied by an 'edit' link to expand the hidden fields.
+ *
+ * @param $element
+ *   An associative array containing the properties of the element.
+ *   Properties used: expandable
+ * @return
+ *   None. Additional code is added to the header of the page using
+ *   drupal_add_js.
+ */
+function form_process_expandable($element) {
+  $class = array();
+
+  // Add resizable behavior
+  if ($element['#expandable'] !== FALSE) {
+    drupal_add_js('misc/form.js');
+
+    if (isset($element['#attributes']['class'])) {
+      $element['#attributes']['class'] = 'form-expandable ' . $element['#attributes']['class'];
+    }
+    else {
+      $element['#attributes']['class'] = 'form-expandable';
+    }
+  }
+  return $element;
+}
+
+/**
  * Format a checkbox.
  *
  * @param $element
