Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.272
diff -u -p -r1.272 form.inc
--- includes/form.inc 6 May 2008 12:18:45 -0000 1.272
+++ includes/form.inc 20 May 2008 10:08:53 -0000
@@ -1824,6 +1824,16 @@ function form_expand_ahah($element) {
}
/**
+ * Expand input format support. Add format selector.
+ */
+function form_expand_format($element) {
+ if (isset($element['#input_format'])) {
+ $element['format'] = filter_form($element['#input_format'], 10, $element['#parents']);
+ }
+ return $element;
+}
+
+/**
* Format a form item.
*
* @param $element
@@ -2066,7 +2076,7 @@ function theme_textarea($element) {
}
_form_set_class($element, $class);
- return theme('form_element', $element, '');
+ return theme('form_element', $element, '') . (!empty($element['#children']) ? $element['#children'] : '');
}
/**
Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.306
diff -u -p -r1.306 block.module
--- modules/block/block.module 15 May 2008 21:30:02 -0000 1.306
+++ modules/block/block.module 20 May 2008 10:08:54 -0000
@@ -308,19 +308,16 @@ function block_box_form($edit = array())
'#required' => TRUE,
'#weight' => -19,
);
- $form['body_field']['#weight'] = -17;
- $form['body_field']['body'] = array(
+
+ $form['body'] = array(
'#type' => 'textarea',
'#title' => t('Block body'),
'#default_value' => $edit['body'],
'#rows' => 15,
'#description' => t('The content of the block as shown to the user.'),
'#weight' => -17,
+ '#input_format' => isset($edit['format']) ? $edit['format'] : FILTER_FORMAT_DEFAULT,
);
- if (!isset($edit['format'])) {
- $edit['format'] = FILTER_FORMAT_DEFAULT;
- }
- $form['body_field']['format'] = filter_form($edit['format'], -16);
return $form;
}
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.633
diff -u -p -r1.633 comment.module
--- modules/comment/comment.module 14 May 2008 13:12:40 -0000 1.633
+++ modules/comment/comment.module 20 May 2008 10:09:00 -0000
@@ -1374,24 +1374,14 @@ function comment_form(&$form_state, $edi
);
}
- if (!empty($edit['comment'])) {
- $default = $edit['comment'];
- }
- else {
- $default = '';
- }
-
- $form['comment_filter']['comment'] = array(
+ $form['comment'] = array(
'#type' => 'textarea',
'#title' => t('Comment'),
'#rows' => 15,
- '#default_value' => $default,
+ '#default_value' => !empty($edit['comment']) ? $edit['comment'] : '',
'#required' => TRUE,
+ '#input_format' => isset($edit['format']) ? $edit['format'] : FILTER_FORMAT_DEFAULT,
);
- if (!isset($edit['format'])) {
- $edit['format'] = FILTER_FORMAT_DEFAULT;
- }
- $form['comment_filter']['format'] = filter_form($edit['format']);
$form['cid'] = array(
'#type' => 'value',
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.213
diff -u -p -r1.213 filter.module
--- modules/filter/filter.module 6 May 2008 12:18:47 -0000 1.213
+++ modules/filter/filter.module 20 May 2008 10:09:00 -0000
@@ -470,7 +470,16 @@ function check_markup($text, $format = F
* @return
* HTML for the form element.
*/
-function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents = array('format')) {
+function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents = NULL) {
+
+ // form_expand_format() adds a 'format' element, which is parent to radio
+ // buttons added in this function. Although then we would get a textarea
+ // child, which would result in the textarea not getting through.
+ // $parents[] = 'format';
+
+ // Hack, until we discuss this.
+ $parents = array('format');
+
$value = filter_resolve_format($value);
$formats = filter_formats();
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.30
diff -u -p -r1.30 node.pages.inc
--- modules/node/node.pages.inc 14 Apr 2008 17:48:38 -0000 1.30
+++ modules/node/node.pages.inc 20 May 2008 10:09:00 -0000
@@ -289,10 +289,9 @@ function node_body_field(&$node, $label,
'#default_value' => $include ? $node->body : ($node->teaser . $node->body),
'#rows' => 20,
'#required' => ($word_count > 0),
+ '#input_format' => isset($node->format) ? $node->format : FILTER_FORMAT_DEFAULT,
);
- $form['format'] = filter_form($node->format);
-
return $form;
}
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.602
diff -u -p -r1.602 system.module
--- modules/system/system.module 7 May 2008 19:17:50 -0000 1.602
+++ modules/system/system.module 20 May 2008 10:09:18 -0000
@@ -229,7 +229,7 @@ function system_elements() {
'#cols' => 60,
'#rows' => 5,
'#resizable' => TRUE,
- '#process' => array('form_expand_ahah'),
+ '#process' => array('form_expand_ahah', 'form_expand_format'),
);
$type['radios'] = array(