Posted by moonray on October 24, 2008 at 5:07pm
Jump to:
| Project: | Recipe |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
The input format selection isn't for an individual field. You couldn't have different formatting for different the fields: body, instructions, notes, source. This makes wysiwyg module unable to attach a wysiwyg editor like TinyMCE to the textarea.
Comments
#1
What do you mean by "The input format selection isn't for an individual field. "?
Specifically, is this a problem with the HTML that Recipe generates?
I'm not familiar with this problem. I'm not using TinyMCE or FCKEditor, but I thought they attached themselves to "all textarea" HTML widgets once you enable them.
#2
Moving to feature request as this is normal Drupal behavior.
#3
From looking at this post (http://drupal.org/node/358316) I was able to get TinyMCE working on the input fields that I wanted (body, instructions, notes). The change itself seems fairly trivial. (Finding out how to do it after using drupal for only a few days, not so trivial.) Take a look at the below snippets from recipe.module:
Original:
function recipe_form(&$node, $form_state){
...
$form['body'] = array(...);
...
$form['instructions'] = array(...);
...
$form['notes'] = array(...);
...
$form['filter'] = filter_form($node->format);
...
return $form;
}
Fixed:
function recipe_form(&$node, $form_state){
...
$form['body']['body'] = array(...);
$form['body']['format'] = filter_form($node->format, NULL, array('body_format'));
...
$form['instructions']['instructions'] = array(...);
$form['instructions']['format'] = filter_form($node->format, NULL, array('instructions_format'));
...
$form['notes']['notes'] = array(...);
$form['notes'']['format'] = filter_form($node->format, NULL, array('notes'_format'));
...
// leaving this uncommented causes an extra format settings section to be shown... can this
// be removed (as shown) or is it still used for some other settings that i missed?
//$form['filter'] = filter_form($node->format);
...
return $form;
}
Could one of the developers confirm this for me and possibly integrate it into the codebase?
Thanks,
ray
#4
#5
+1 on this. I would really like WYSIWYG to work with the Recipe module.
#6
Patch looks good and it tested ok. Please give it a test yourselves as well.
Just added to the dev snapshot dated on/after May 10.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.
#8
Hello there
I tried to add a wysiwyg on the instructions field, but nothing happend
The only way I found to do it is to create a form_alter and to do a like it's was said in comment #3
Here is an example :
/**
* Implementation of hook_form_alter().
*/
function example_recipe_form_recipe_node_form_alter(&$form, $form_state) {
// Regeneration of the instructions field to be compatible with Wysiwyg
$instructions_format = $form['instructions']['format'];
UNSET($form['instructions']['format']);
$instructions = $form['instructions'];
UNSET($form['instructions']);
// The new Instruction field valid for the Wysiwyg
$form['instructions'] = array(
'#type' => 'item',
'instructions' => $instructions,
'format' => $instructions_format,
);
}
#9
@JulienD,
Please add new issues for new items.
You might want to try the latest dev version available tonight/tomorrow for your problem.