diff --git a/modules/field/modules/text/text.js b/modules/field/modules/text/text.js
index 2f761f384a3..42f16c9e03b 100644
--- a/modules/field/modules/text/text.js
+++ b/modules/field/modules/text/text.js
@@ -11,8 +11,8 @@ Drupal.behaviors.textSummary = {
var $widget = $(this).closest('div.field-type-text-with-summary');
var $summary = $widget.find('div.text-summary-wrapper');
var $summaryLabel = $summary.find('label');
- var $full = $widget.find('div.text-full-wrapper');
- var $fullLabel = $full.find('div.form-type-textarea label');
+ var $full = $widget.find('.form-item:has(.text-full)');
+ var $fullLabel = $full.find('label');
// Setup the edit/hide summary link.
var $link = $('(' + Drupal.t('Hide summary') + ')').toggle(
diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module
index 14262e201b0..9685a2bb93a 100644
--- a/modules/field/modules/text/text.module
+++ b/modules/field/modules/text/text.module
@@ -521,8 +521,7 @@ function text_field_widget_form(&$form, &$form_state, $field, $instance, $langco
'#type' => 'textfield',
'#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL,
'#size' => $instance['widget']['settings']['size'],
- '#prefix' => '
',
- '#suffix' => '
',
+ '#attributes' => array('class' => array('text-full')),
);
break;
@@ -549,8 +548,7 @@ function text_field_widget_form(&$form, &$form_state, $field, $instance, $langco
'#type' => 'textarea',
'#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL,
'#rows' => $instance['widget']['settings']['rows'],
- '#prefix' => '',
- '#suffix' => '
',
+ '#attributes' => array('class' => array('text-full')),
);
break;
}
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index e3d29fe4e08..126ce1123a9 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -746,8 +746,9 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE)
* If multiple text format-enabled elements are required on the same level of
* the form structure, modules can set custom #parents on the original element.
* Alternatively, the #after_build may be unset through a subsequent #process
- * callback. If no custom processing occurs, then the submitted form values will
- * appear like in the $form_state['input'] array above.
+ * callback. If the default #after_build is not invoked and no custom processing
+ * occurs, then the submitted form values will appear like in the
+ * $form_state['input'] array above.
*
* @see filter_form_after_build()
*
@@ -785,11 +786,11 @@ function filter_process_format($element) {
'#processed',
'#theme_wrappers',
);
- // Move this element into sub-element 'value'.
+ // Move this element into sub-element 'value'.
unset($element['value']);
- foreach ($element as $key => $value) {
- if ($key[0] === '#' && !in_array($key, $blacklist)) {
- $element['value'][$key] = $value;
+ foreach (element_properties($element) as $key) {
+ if (!in_array($key, $blacklist)) {
+ $element['value'][$key] = $element[$key];
}
}
@@ -839,7 +840,6 @@ function filter_process_format($element) {
'#weight' => 10,
'#attributes' => array('class' => array('filter-list')),
'#parents' => array_merge($element['#parents'], array('format')),
- '#value_callback' => 'filter_form_value_callback_format',
);
$element['format']['help'] = array(
@@ -853,23 +853,24 @@ function filter_process_format($element) {
}
/**
- * After build, we need to move the values up in $form_state.
+ * After build callback to move #type 'text_format' values up in $form_state.
*/
function filter_form_after_build($element, &$form_state) {
- $parents = $element['#parents'];
- $original_key = array_pop($parents);
-
// For text fields, the additional subkeys map 1:1 to field schema columns.
if (isset($element['#columns'])) {
return $element;
}
+ $parents = $element['#parents'];
+ array_pop($parents);
+
foreach (element_children($element) as $key) {
$current_parents = $parents;
switch ($key) {
case 'value':
form_set_value(array('#parents' => $element['#parents']), $element[$key]['#value'], $form_state);
break;
+
case 'format':
$current_parents[] = $key;
form_set_value(array('#parents' => $current_parents), $element['format']['format']['#value'], $form_state);