diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index a5187b58e6be72f8082417bbc1fbd2a7a4ee0177..131b214445c0a4caa7cc0f6719397d9aad4c5613 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -442,9 +442,9 @@ function block_add_block_form_validate($form, &$form_state) { function block_add_block_form_submit($form, &$form_state) { $delta = db_insert('block_custom') ->fields(array( - 'body' => $form_state['values']['body'], + 'body' => $form_state['values']['body']['value'], 'info' => $form_state['values']['info'], - 'format' => $form_state['values']['format'], + 'format' => $form_state['values']['body']['format'], )) ->execute(); // Store block delta to allow other modules to work with new block. diff --git a/modules/block/block.module b/modules/block/block.module index 12b916ad01593b59f7a5b5e120c43bd9afd664b5..3770bb277621c7e8b0006e0860426e3fef4636d1 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -469,8 +469,9 @@ function block_custom_block_form($edit = array()) { * @param $edit * Associative array of fields to save. Array keys: * - info: Block description. - * - body: Block contents. - * - format: Filter ID of the filter format for the body. + * - body: Associative array of body value and format. Array keys: + * - value: Block contents. + * - format: Filter ID of the filter format for the body. * @param $delta * Block ID of the block to save. * @return @@ -479,9 +480,9 @@ function block_custom_block_form($edit = array()) { function block_custom_block_save($edit, $delta) { db_update('block_custom') ->fields(array( - 'body' => $edit['body'], + 'body' => $edit['body']['value'], 'info' => $edit['info'], - 'format' => $edit['format'], + 'format' => $edit['body']['format'], )) ->condition('bid', $delta) ->execute(); diff --git a/modules/filter/filter.module b/modules/filter/filter.module index ad5ec9b194d29881e0565ef92695e5b46b3eba6c..21cc0fe8c94aeb7792d6e9fc33832a4d9ce682ad 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -730,29 +730,12 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE) * the text format id specified in #format or the user's default format by * default, if NULL. * - * Since most modules expect the value of the new 'format' element *next* to the - * original element, filter_process_format() utilizes an #after_build to move - * the values of the children of the 'text_format' element so as to let the - * submitted form values appear as if they were located on the same level. - * For example, considering the input values: + * The resulting value for the element will be an array holding the value and the + * format. For example, the value for the body element will be: * @code - * $form_state['input']['body']['value'] = 'foo'; - * $form_state['input']['body']['format'] = 'foo'; + * $form_state['values']['body']['value'] = 'foo'; + * $form_state['values']['body']['format'] = 'foo'; * @endcode - * The #after_build will process them into: - * @code - * $form_state['values']['body'] = 'foo'; - * $form_state['values']['format'] = 'foo'; - * @endcode - * - * 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 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() * * @param $element * The form element to process. Properties used: @@ -804,9 +787,6 @@ function filter_process_format($element) { $element['#attached']['js'][] = $path . '/filter.js'; $element['#attached']['css'][] = $path . '/filter.css'; - // Apply default #after_build behavior. - $element['#after_build'][] = 'filter_form_after_build'; - // Setup child container for the text format widget. $element['format'] = array( '#type' => 'fieldset', @@ -886,38 +866,6 @@ function filter_process_format($element) { return $element; } -/** - * After build callback to move #type 'text_format' values up in $form_state. - */ -function filter_form_after_build($element, &$form_state) { - // 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); - break; - - default: - $current_parents[] = $key; - form_set_value(array('#parents' => $current_parents), $element[$key]['#value'], $form_state); - } - } - return $element; -} - /** * #pre_render callback for #type 'text_format' to hide field value from prying eyes. * diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index 4ae0e51821f9c6984b79a8dc6a0e4406b71ab4b3..59defe82cbed4f9ece8307d68c3f90923c3fd9d7 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -837,6 +837,12 @@ function taxonomy_form_term_submit($form, &$form_state) { */ function taxonomy_form_term_submit_builder($form, &$form_state) { $term = (object) $form_state['values']; + + // Convert text_format field into values expected by taxonomy_term_save(). + $description = $form_state['values']['description']; + $term->description = $description['value']; + $term->format = $description['format']; + field_attach_submit('taxonomy_term', $term, $form, $form_state); $form_state['term'] = (array) $term;