? 250451-7.x-1.patch
? field_widgets-362058-15.patch
? sites/all/modules/devel
? sites/default/files
? sites/default/private
? sites/default/settings.php
Index: modules/field/modules/number/number.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/number/number.module,v
retrieving revision 1.15
diff -u -p -r1.15 number.module
--- modules/field/modules/number/number.module	27 Aug 2009 00:33:51 -0000	1.15
+++ modules/field/modules/number/number.module	27 Aug 2009 07:22:27 -0000
@@ -303,46 +303,38 @@ function number_elements() {
       '#input' => TRUE,
       '#columns' => array('value'), '#delta' => 0,
       '#process' => array('number_elements_process'),
+      '#number_type' => 'decimal',
+      '#precision' => 10,
+      '#scale' => 2,
+      '#decimal_point' => '.',
     ),
   );
 }
 
 /**
  * Implement hook_field_widget().
- *
- * Attach a single form element to the form. It will be built out and
- * validated in the callback(s) listed in hook_elements. We build it
- * out in the callbacks rather than here in hook_widget so it can be
- * plugged into any module that can provide it with valid
- * $field information.
- *
- * Field module will set the weight, field name and delta values
- * for each form element.
- *
- * If there are multiple values for this field, the Field module will
- * call this function as many times as needed.
- *
- * @param $form
- *   the entire form array, $form['#node'] holds node information
- * @param $form_state
- *   the form_state, $form_state['values'] holds the form values.
- * @param $field
- *   The field structure.
- * @param $instance
- *   the field instance array
- * @param $langcode
- *   The language associated to $items.
- * @param $delta
- *   the order of this item in the array of subelements (0, 1, 2, etc)
- *
- * @return
- *   the form item for a single element for this field
  */
 function number_field_widget(&$form, &$form_state, $field, $instance, $langcode, $items, $delta = 0) {
+  $type = explode('_', $field['type'], 2);
   $element = array(
     '#type' => $instance['widget']['type'],
     '#default_value' => isset($items[$delta]) ? $items[$delta] : NULL,
+    '#number_type' => $type[1],
   );
+
+  $element['#precision'] = $field['settings']['precision'];
+  $element['#decimal'] = $field['settings']['decimal'];
+  $element['#scale'] = $field['settings']['scale'];
+
+  if (!empty($instance['settings']['prefix'])) {
+    $prefixes = explode('|', $instance['settings']['prefix']);
+    $element['#field_prefix'] = array_pop($prefixes);
+  }
+  if (!empty($instance['settings']['suffix'])) {
+    $suffixes = explode('|', $instance['settings']['suffix']);
+    $element['#field_suffix'] = array_pop($suffixes);
+  }
+
   return $element;
 }
 
@@ -359,17 +351,13 @@ function number_field_widget_error($elem
  * Build the form element. When creating a form using FAPI #process,
  * note that $element['#value'] is already set.
  *
- * The $field and $instance arrays are in $form['#fields'][$element['#field_name']].
  */
 function number_elements_process($element, $form_state, $form) {
-  $field_name = $element['#field_name'];
-  $field = field_info_field($element['#field_name']);
-  $instance = field_info_instance($element['#field_name'], $element['#bundle']);
   $field_key  = $element['#columns'][0];
 
   $value = isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : '';
-  if ($field['type'] == 'number_decimal') {
-    $value = str_replace('.', $field['settings']['decimal'], $value);
+  if ($element['#number_type'] == 'decimal') {
+    $value = str_replace('.', $element['#decimal_point'], $value);
   }
 
   $element[$field_key] = array(
@@ -377,41 +365,36 @@ function number_elements_process($elemen
     '#default_value' => $value,
     // Need to allow a slightly larger size that the field length to allow
     // for some configurations where all characters won't fit in input field.
-    '#size' => $field['type'] == 'number_decimal' ? $field['settings']['precision'] + 2 : 12,
-    '#maxlength' => $field['type'] == 'number_decimal' ? $field['settings']['precision'] : 10,
+    '#size' => $element['#number_type'] == 'decimal' ? $element['#precision'] + 2 : 12,
+    '#maxlength' => $element['#number_type'] == 'decimal' ? $element['#precision'] : 10,
+
     '#attributes' => array('class' => array('number')),
     // The following values were set by the Field module and need
     // to be passed down to the nested element.
     '#title' => $element['#title'],
     '#description' => $element['#description'],
     '#required' => $element['#required'],
-    '#field_name' => $element['#field_name'],
-    '#bundle' => $element['#bundle'],
-    '#delta' => $element['#delta'],
-    '#columns' => $element['#columns'],
   );
 
-  if (!empty($instance['settings']['prefix'])) {
-    $prefixes = explode('|', $instance['settings']['prefix']);
-    $element[$field_key]['#field_prefix'] = field_filter_xss(array_pop($prefixes));
+  if (!empty($element['#field_prefix'])) {
+    $element[$field_key]['#field_prefix'] = $element['#field_prefix'];
   }
-  if (!empty($instance['settings']['suffix'])) {
-    $suffixes = explode('|', $instance['settings']['suffix']);
-    $element[$field_key]['#field_suffix'] = field_filter_xss(array_pop($suffixes));
+  if (!empty($element['#field_suffix'])) {
+    $element[$field_key]['#field_suffix'] = $element['#field_suffix'];
   }
 
   // Make sure we don't wipe out element validation added elsewhere.
   if (empty($element['#element_validate'])) {
     $element['#element_validate'] = array();
   }
-  switch ($field['type']) {
-    case 'number_float':
+  switch ($element['#number_type']) {
+    case 'float':
       $element['#element_validate'][] = 'number_float_validate';
       break;
-    case 'number_integer':
+    case 'integer':
       $element['#element_validate'][] = 'number_integer_validate';
       break;
-    case 'number_decimal':
+    case 'decimal':
       $element['#element_validate'][] = 'number_decimal_validate';
       break;
   }
@@ -423,8 +406,6 @@ function number_elements_process($elemen
  * FAPI validation of an individual float element.
  */
 function number_float_validate($element, &$form_state) {
-  $field = field_info_field($element['#field_name']);
-  $instance = field_info_instance($element['#field_name'], $element['#bundle']);
   $field_key = $element['#columns'][0];
   $value = $element['#value'][$field_key];
 
@@ -433,7 +414,7 @@ function number_float_validate($element,
     $value = preg_replace('@[^-0-9\.]@', '', $value);
     if ($start != $value) {
       $error_field = implode('][', $element['#parents']) . '][' . $field_key;
-      form_set_error($error_field, t('Only numbers and decimals are allowed in %field.', array('%field' => t($instance['label']))));
+      form_set_error($error_field, t('Only numbers and decimals are allowed in %field.', array('%field' => $element['#title'])));
     }
     else {
       form_set_value($element[$field_key], $value, $form_state);
@@ -445,8 +426,6 @@ function number_float_validate($element,
  * FAPI validation of an individual integer element.
  */
 function number_integer_validate($element, &$form_state) {
-  $field = field_info_field($element['#field_name']);
-  $instance = field_info_instance($element['#field_name'], $element['#bundle']);
   $field_key = $element['#columns'][0];
   $value = $element['#value'][$field_key];
 
@@ -455,7 +434,7 @@ function number_integer_validate($elemen
     $value = preg_replace('@[^-0-9]@', '', $value);
     if ($start != $value) {
       $error_field = implode('][', $element['#parents']) . '][' . $field_key;
-      form_set_error($error_field, t('Only numbers are allowed in %field.', array('%field' => t($instance['label']))));
+      form_set_error($error_field, t('Only numbers are allowed in %field.', array('%field' => $element['#title'])));
     }
     else {
       form_set_value($element[$field_key], $value, $form_state);
@@ -467,21 +446,19 @@ function number_integer_validate($elemen
  * FAPI validation of an individual decimal element.
  */
 function number_decimal_validate($element, &$form_state) {
-  $field = field_info_field($element['#field_name']);
-  $instance = field_info_instance($element['#field_name'], $element['#bundle']);
   $field_key = $element['#columns'][0];
   $value = $element['#value'][$field_key];
 
   if (($element[$field_key]['#required'] || !empty($value))) {
     $start = $value;
-    $value = preg_replace('@[^-0-9\\' . $field['settings']['decimal'] . ']@', '', $value);
+    $value = preg_replace('@[^-0-9\\' . $element['#decimal_point'] . ']@', '', $value);
     if ($start != $value) {
       $error_field = implode('][', $element['#parents']) . '][' . $field_key;
-      form_set_error($error_field, t('Only numbers and the decimal character (%decimal) are allowed in %field.', array('%decimal' => $field['settings']['decimal'], '%field' => t($instance['label']))));
+      form_set_error($error_field, t('Only numbers and the decimal character (%decimal) are allowed in %field.', array('%decimal' => $element['#decimal_point'], '%field' => $element['#title'])));
     }
     else {
-      $value = str_replace($field['settings']['decimal'], ' .', $value);
-      $value = round($value, $field['settings']['scale']);
+      $value = str_replace($element['#decimal_point'], ' .', $value);
+      $value = round($value, $element['#scale']);
       form_set_value($element[$field_key], $value, $form_state);
     }
   }
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	27 Aug 2009 07:22:28 -0000
@@ -81,16 +81,22 @@ function options_elements() {
       '#input' => TRUE,
       '#columns' => array('value'), '#delta' => 0,
       '#process' => array('options_select_elements_process'),
+      '#required' => FALSE,
+      '#cardinality' => 1,
       ),
     'options_buttons' => array(
       '#input' => TRUE,
       '#columns' => array('value'), '#delta' => 0,
       '#process' => array('options_buttons_elements_process'),
+      '#required' => FALSE,
+      '#cardinality' => 1,
       ),
     'options_onoff' => array(
       '#input' => TRUE,
       '#columns' => array('value'), '#delta' => 0,
       '#process' => array('options_onoff_elements_process'),
+      '#required' => FALSE,
+      '#cardinality' => 1,
       ),
     );
 }
@@ -102,6 +108,10 @@ function options_field_widget(&$form, &$
   $element = array(
     '#type' => $instance['widget']['type'],
     '#default_value' => !empty($items) ? $items : array(),
+    // I know, stupid name, but #options are handled by core, in an incompatible way.
+    '#options_options' => options_options($field, $instance),
+    '#required' => $instance['required'],
+    '#cardinality' => $field['cardinality'],
   );
   return $element;
 }
@@ -120,26 +130,22 @@ function options_field_widget_error($ele
  * Build the form element. When creating a form using FAPI #process,
  * note that $element['#value'] is already set.
  *
- * The $field and $instance arrays are in $form['#fields'][$element['#field_name']].
  */
 function options_buttons_elements_process($element, &$form_state, $form) {
-  $field = $form['#fields'][$element['#field_name']]['field'];
-  $instance = $form['#fields'][$element['#field_name']]['instance'];
   $field_key  = $element['#columns'][0];
 
   // See if this element is in the database format or the transformed format,
   // and transform it if necessary.
   if (is_array($element['#value']) && !array_key_exists($field_key, $element['#value'])) {
-    $element['#value'] = options_data2form($element, $element['#default_value'], $field);
+    $element['#value'] = options_data2form($element, $element['#default_value']);
   }
-  $options = options_options($field, $instance);
-  $multiple = isset($element['#multiple']) ? $element['#multiple'] : $field['cardinality'] > 1 || $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED;
 
+  $multiple = $element['#cardinality'] > 1 || $element['#cardinality'] == FIELD_CARDINALITY_UNLIMITED;
   $value = array();
   foreach ($element['#value'][$field_key] as $key) {
     // Multiple (checkboxes) need the default value in the form of an array.
     if ($multiple) {
-      $value[$key] = 1;
+      $value[] = $key;
     }
     // Non-multiple (radios) need single default value.
     else {
@@ -152,9 +158,9 @@ function options_buttons_elements_proces
     '#type' => $multiple ? 'checkboxes' : 'radios',
     '#title' => $element['#title'],
     '#description' => $element['#description'],
-    '#required' => isset($element['#required']) ? $element['#required'] : $instance['required'],
+    '#required' => $element['#required'],
     '#multiple' => $multiple,
-    '#options' => $options,
+    '#options' => $element['#options_options'],
     '#default_value' => $value,
   );
 
@@ -165,9 +171,6 @@ function options_buttons_elements_proces
   }
   array_unshift($element['#element_validate'], 'options_validate');
 
-  // Make sure field info will be available to the validator which
-  // does not get the values in $form.
-  $form_state['#fields'][$element['#field_name']] = $form['#fields'][$element['#field_name']];
   return $element;
 }
 
@@ -177,27 +180,23 @@ function options_buttons_elements_proces
  * Build the form element. When creating a form using FAPI #process,
  * note that $element['#value'] is already set.
  *
- * The $field and $instance arrays are in $form['#fields'][$element['#field_name']].
  */
 function options_select_elements_process($element, &$form_state, $form) {
-  $field = $form['#fields'][$element['#field_name']]['field'];
-  $instance = $form['#fields'][$element['#field_name']]['instance'];
   $field_key  = $element['#columns'][0];
 
   // See if this element is in the database format or the transformed format,
   // and transform it if necessary.
   if (is_array($element['#value']) && !array_key_exists($field_key, $element['#value'])) {
-    $element['#value'] = options_data2form($element, $element['#default_value'], $field);
+    $element['#value'] = options_data2form($element, $element['#default_value']);
   }
 
-  $options = options_options($field, $instance);
   $element[$field_key] = array(
     '#type' => 'select',
     '#title' => $element['#title'],
     '#description' => $element['#description'],
-    '#required' => isset($element['#required']) ? $element['#required'] : $instance['required'],
-    '#multiple' => isset($element['#multiple']) ? $element['#multiple'] : $field['cardinality'] > 1 || $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED,
-    '#options' => $options,
+    '#required' => $element['#required'],
+    '#multiple' => $element['#cardinality'] > 1 || $element['#cardinality'] == FIELD_CARDINALITY_UNLIMITED,
+    '#options' => $element['#options_options'],
     '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
   );
 
@@ -208,9 +207,6 @@ function options_select_elements_process
   }
   array_unshift($element['#element_validate'], 'options_validate');
 
-  // Make sure field info will be available to the validator which
-  // does not get the values in $form.
-  $form_state['#fields'][$element['#field_name']] = $form['#fields'][$element['#field_name']];
   return $element;
 }
 
@@ -221,16 +217,14 @@ function options_select_elements_process
  * note that $element['#value'] is already set.
  */
 function options_onoff_elements_process($element, &$form_state, $form) {
-  $field = $form['#fields'][$element['#field_name']]['field'];
-  $instance = $form['#fields'][$element['#field_name']]['instance'];
   $field_key  = $element['#columns'][0];
 
   // See if this element is in the database format or the transformed format,
   // and transform it if necessary.
   if (is_array($element['#value']) && !array_key_exists($field_key, $element['#value'])) {
-    $element['#value'] = options_data2form($element, $element['#default_value'], $field);
+    $element['#value'] = options_data2form($element, $element['#default_value']);
   }
-  $options = options_options($field, $instance);
+  $options = $element['#options_options'];
   $keys = array_keys($options);
   $on_value = (!empty($keys) && isset($keys[1])) ? $keys[1] : NULL;
   $element[$field_key] = array(
@@ -248,9 +242,6 @@ function options_onoff_elements_process(
   }
   array_unshift($element['#element_validate'], 'options_validate');
 
-  // Make sure field info will be available to the validator which
-  // does not get the values in $form.
-  $form_state['#fields'][$element['#field_name']] = $form['#fields'][$element['#field_name']];
   return $element;
 }
 
@@ -262,20 +253,19 @@ function options_validate($element, &$fo
   // turning cardinality selected options into cardinality parent elements.
   // Immediate parent is the delta, need to get back to parent's parent
   // to create cardinality elements.
-  $field = $form_state['#fields'][$element['#field_name']]['field'];
-  $items = options_form2data($element, $field);
+  $items = options_form2data($element);
   form_set_value($element, $items, $form_state);
 
   // Check we don't exceed the allowed number of values.
-  if ($field['cardinality'] >= 2) {
+  if ($element['#cardinality'] >= 2) {
     // Filter out 'none' value (if present, will always be in key 0)
     $field_key = $element['#columns'][0];
     if (isset($items[0][$field_key]) && $items[0][$field_key] === '') {
       unset($items[0]);
     }
-    if (count($items) > $field['cardinality']) {
+    if (count($items) > $element['#cardinality']) {
       $field_key  = $element['#columns'][0];
-      form_error($element[$field_key], t('%name: this field cannot hold more that @count values.', array('%name' => t($field['widget']['label']), '@count' => $field['cardinality'])));
+      form_error($element[$field_key], t('%name: this field cannot hold more that @count values.', array('%name' => $element['#title'], '@count' => $element['#cardinality'])));
     }
   }
 }
@@ -285,22 +275,19 @@ function options_validate($element, &$fo
  * to the format the widget needs. Can be called anywhere this
  * transformation is needed.
  */
-function options_data2form($element, $items, $field) {
+function options_data2form($element, $items) {
   $field_key  = $element['#columns'][0];
-  $field = field_info_field($element['#field_name']);
-  $instance = field_info_instance($element['#field_name'], $element['#bundle']);
-  $options    = options_options($field, $instance);
 
   $items_transposed = options_transpose_array_rows_cols($items);
   $values = (isset($items_transposed[$field_key]) && is_array($items_transposed[$field_key])) ? $items_transposed[$field_key] : array();
   $keys = array();
   foreach ($values as $value) {
-    $key = array_search($value, array_keys($options));
+    $key = array_search($value, array_keys($element['#options_options']));
     if (isset($key)) {
       $keys[] = $value;
     }
   }
-  if ($field['cardinality'] || $element['#type'] == 'options_onoff') {
+  if ($element['#cardinality'] || $element['#type'] == 'options_onoff') {
     return array($field_key => $keys);
   }
   else {
@@ -313,17 +300,14 @@ function options_data2form($element, $it
  * to the format to be stored in the field. Can be called anywhere this
  * transformation is needed.
  */
-function options_form2data($element, $field) {
+function options_form2data($element) {
   $field_key = $element['#columns'][0];
-  $field = field_info_field($element['#field_name']);
-  $instance = field_info_instance($element['#field_name'], $element['#bundle']);
   $items = (array) $element[$field_key]['#value'];
-  $options = options_options($field, $instance);
 
   $values = array_values($items);
 
   if ($element['#type'] == 'options_onoff' && ($values[0] === 0)) {
-    $keys = array_keys($options);
+    $keys = array_keys($element['#options_options']);
     $values = array(array_key_exists(0, $keys) ? $keys[0] : NULL);
   }
 
@@ -413,7 +397,7 @@ function theme_options_none($instance) {
  * make custom changes to the output.
  *
  * $element['#field_name'] contains the field name
- * $element['#delta] is the position of this element in the group
+ * $element['#delta'] is the position of this element in the group
  */
 function theme_options_select($element) {
   return $element['#children'];
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	27 Aug 2009 07:22:28 -0000
@@ -323,7 +323,6 @@ function theme_field_formatter_text_plai
  * Theme function for 'trimmed' text field formatter.
  */
 function theme_field_formatter_text_trimmed($element) {
-  $field = field_info_field($element['#field_name']);
   $instance = field_info_instance($element['#field_name'], $element['#bundle']);
   return text_summary($element['#item']['safe'], $instance['settings']['text_processing'] ? $element['#item']['format'] : NULL);
 }
@@ -498,7 +497,7 @@ function text_field_widget_info() {
     'text_textarea_with_summary' => array(
       'label' => t('Text area with a summary'),
       'field types' => array('text_with_summary'),
-      'settings' => array('rows' => 20, 'summary_rows' => 5),
+      'settings' => array('rows' => 20, 'summary_rows' => 5, 'display_summary' => FALSE),
     ),
   );
 }
@@ -551,65 +550,52 @@ function text_elements() {
       '#columns' => array('value'), '#delta' => 0,
       '#process' => array('text_textfield_elements_process'),
       '#theme_wrappers' => array('text_textfield'),
+      '#size' => 60,
+      '#text_processing' => FALSE,
       '#autocomplete_path' => FALSE,
     ),
     'text_textarea' => array(
       '#input' => TRUE,
       '#columns' => array('value', 'format'), '#delta' => 0,
-      '#process' => array('text_textarea_elements_process'),
+      '#rows' => 5,
+      '#text_processing' => FALSE,
       '#theme_wrappers' => array('text_textarea'),
-      '#filter_value' => FILTER_FORMAT_DEFAULT,
+      '#process' => array('text_textarea_elements_process'),
     ),
     'text_textarea_with_summary' => array(
       '#input' => TRUE,
       '#columns' => array('value', 'format', 'summary'), '#delta' => 0,
+      '#rows' => 5,
+      '#text_processing' => FALSE,
+      '#display_summary' => FALSE,
+      '#summary_rows' => 5,
       '#process' => array('text_textarea_with_summary_process'),
       '#theme_wrappers' => array('text_textarea'),
-      '#filter_value' => FILTER_FORMAT_DEFAULT,
     ),
   );
 }
 
 /**
  * Implement hook_field_widget().
- *
- * Attach a single form element to the form. It will be built out and
- * validated in the callback(s) listed in hook_elements. We build it
- * out in the callbacks rather than here in hook_field_widget so it can be
- * plugged into any module that can provide it with valid
- * $field information.
- *
- * Field module will set the weight, field name and delta values
- * for each form element.
- *
- * If there are multiple values for this field, the field module will
- * call this function as many times as needed.
- *
- * @param $form
- *   the entire form array, $form['#node'] holds node information
- * @param $form_state
- *   the form_state, $form_state['values'][$field['field_name']]
- *   holds the field's form values.
- * @param $field
- *   The field structure.
- * @param $instance
- *   the field instance array
- * @param $langcode
- *   The language associated to $items.
- * @param $items
- *   array of default values for this field
- * @param $delta
- *   the order of this item in the array of subelements (0, 1, 2, etc)
- *
- * @return
- *   the form item for a single element for this field
  */
 function text_field_widget(&$form, &$form_state, $field, $instance, $langcode, $items, $delta = 0) {
   $element = array(
     '#type' => $instance['widget']['type'],
     '#default_value' => isset($items[$delta]) ? $items[$delta] : '',
+    '#text_processing' => ($instance['settings']['text_processing'] == 1),
   );
-  if (!empty($instance['settings']['text_processing'])) {
+  if ($instance['widget']['type'] == 'text_textfield') {
+    $element['#size'] = $instance['widget']['settings']['size'];
+    $element['#max_length'] = $field['settings']['max_length'];
+  }
+  elseif ($instance['widget']['type'] == 'text_textarea') {
+    $element['#rows'] = $instance['widget']['settings']['rows'];
+  } elseif ($instance['widget']['type'] == 'text_textarea_with_summary') {
+    $element['#rows'] = $instance['widget']['settings']['rows'];
+    $element['#display_summary'] = $instance['widget']['settings']['display_summary'];
+    $element['#summary_rows'] = $instance['widget']['settings']['summary_rows'];
+  }
+  if ($element['#text_processing']) {
     $element['#value_callback'] = 'text_field_widget_formatted_text_value';
   }
 
@@ -635,20 +621,12 @@ function text_field_widget_error($elemen
 
 /**
  * Process an individual element.
- *
+*
  * Build the form element. When creating a form using FAPI #process,
  * note that $element['#value'] is already set.
  *
- * The $field and $instance arrays are in $form['#fields'][$element['#field_name']].
- *
- * TODO: For widgets to be actual FAPI 'elements', reusable outside of a
- * 'field' context, they shoudn't rely on $field and $instance. The bits of
- * information needed to adjust the behavior of the 'element' should be
- * extracted in hook_field_widget() above.
  */
 function text_textfield_elements_process($element, $form_state, $form) {
-  $field = $form['#fields'][$element['#field_name']]['field'];
-  $instance = $form['#fields'][$element['#field_name']]['instance'];
   $field_key = $element['#columns'][0];
   $delta = $element['#delta'];
 
@@ -656,17 +634,17 @@ function text_textfield_elements_process
     '#type' => 'textfield',
     '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
     '#autocomplete_path' => $element['#autocomplete_path'],
-    '#size' => $instance['widget']['settings']['size'],
+    '#size' => $element['#size'],
     '#attributes' => array('class' => array('text')),
     '#title' => $element['#title'],
     '#description' => $element['#description'],
     '#required' => $element['#required'],
   );
 
-  $element[$field_key]['#maxlength'] = !empty($field['settings']['max_length']) ? $field['settings']['max_length'] : NULL;
+  $element[$field_key]['#maxlength'] = !empty($element['#max_length']) ? $element['#max_length'] : NULL;
 
-  if (!empty($instance['settings']['text_processing'])) {
-    $filter_key  = (count($element['#columns']) == 2) ? $element['#columns'][1] : 'format';
+  if ($element['#text_processing']) {
+    $filter_key = (count($element['#columns']) == 2) ? $element['#columns'][1] : 'format';
     $format = isset($element['#value'][$filter_key]) ? $element['#value'][$filter_key] : FILTER_FORMAT_DEFAULT;
     $element[$field_key]['#text_format'] = $format;
   }
@@ -680,25 +658,22 @@ function text_textfield_elements_process
  * Build the form element. When creating a form using FAPI #process,
  * note that $element['#value'] is already set.
  *
- * The $field and $instance arrays are in $form['#fields'][$element['#field_name']].
  */
 function text_textarea_elements_process($element, $form_state, $form) {
-  $field = $form['#fields'][$element['#field_name']]['field'];
-  $instance = $form['#fields'][$element['#field_name']]['instance'];
   $field_key = $element['#columns'][0];
   $delta = $element['#delta'];
 
   $element[$field_key] = array(
     '#type' => 'textarea',
     '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
-    '#rows' => $instance['widget']['settings']['rows'],
+    '#rows' => $element['#rows'],
     '#weight' => 0,
     '#title' => $element['#title'],
     '#description' => $element['#description'],
     '#required' => $element['#required'],
   );
 
-  if (!empty($instance['settings']['text_processing'])) {
+  if ($element['#text_processing']) {
     $filter_key = (count($element['#columns']) == 2) ? $element['#columns'][1] : 'format';
     $format = isset($element['#value'][$filter_key]) ? $element['#value'][$filter_key] : FILTER_FORMAT_DEFAULT;
     $element[$field_key]['#text_format'] = $format;
@@ -716,17 +691,15 @@ function text_textarea_elements_process(
  * The $field and $instance arrays are in $form['#fields'][$element['#field_name']].
  */
 function text_textarea_with_summary_process($element, $form_state, $form) {
-  $field = $form['#fields'][$element['#field_name']]['field'];
-  $instance = $form['#fields'][$element['#field_name']]['instance'];
   $delta = $element['#delta'];
 
   $field_key = $element['#columns'][1];
-  $display = !empty($element['#value'][$field_key]) || !empty($instance['settings']['display_summary']);
+  $display = !empty($element['#value'][$field_key]) || !empty($element['#display_summary']);
   $element[$field_key] = array(
     '#title' => t('Summary'),
     '#type' => $display ? 'textarea' : 'value',
     '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
-    '#rows' => $instance['widget']['settings']['summary_rows'],
+    '#rows' => $element['#summary_rows'],
     '#weight' => 0,
     '#title' => t('Summary'),
     '#description' => t('Leave blank to use trimmed value of full text as the summary.'),
@@ -738,15 +711,14 @@ function text_textarea_with_summary_proc
   $element[$field_key] = array(
     '#type' => 'textarea',
     '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
-    '#rows' => $instance['widget']['settings']['rows'],
+    '#rows' => $element['#summary_rows'],
     '#weight' => 1,
     '#title' => $display ? t('Full text') : $element['#title'],
     '#description' => $element['#description'],
     '#required' => $element['#required'],
-    '#required' => $instance['required'],
   );
 
-  if (!empty($instance['settings']['text_processing'])) {
+  if (!empty($element['#text_processing'])) {
     $filter_key  = (count($element['#columns']) == 2) ? $element['#columns'][1] : 'format';
     $format = isset($element['#value'][$filter_key]) ? $element['#value'][$filter_key] : FILTER_FORMAT_DEFAULT;
     $element[$field_key]['#text_format'] = $format;
