I often create my own content (node) types through custom modules and the APIs available in Drupal's core. It allows for better customization of access and is (arguably) more portable than CCK when needing to deploy to multiple environments. I found if I define a field "teaser" in my type's form (hook_form), I can specify the teaser content without it needing to be a substring of the main node body. This is often essential as the teaser and body may have no overlapping content (a genuine "summary").

Now I'm confronted with an awkward scenario. There is only input format per node revision and it applies to both the teaser and body. However, only the body textarea is converted to a WYSIWYG. I've tried digging through old issues for this project and it looks like the '#wysiwyg' FAPI attribute has been shot down. How else I can force the use of an editor? Any suggestions as to a different way of approaching my problem?

FYI: I'm using Drupal 6.10, WYSIWYG 1.0 and TinyMCE 3.2.1.1.

Comments

sun’s picture

Title: Editor for teaser when it is its own field » How to add editor to a custom form field
Status: Active » Fixed

Better title.

1) This is by design. If Wysiwyg API was not triggered by input formats, then we would have an awkward "visibility" configuration like previous editor-integration modules had.

2) In general, what you need is an input format selector for your textarea. http://drupal.org/node/358316 contains some developer information about this.

3) However, in your case, I understand that you would still want the same input format as the regular body field. That is not possible, because the user can change the input format in the form. In general, I would highly recommend using a CCK text field as separate teaser field instead. You mentioned you have issues with that, but I cannot see any. I'm using exactly this approach on a lot of Drupal sites with success.

4) Yes, #wysiwyg was dropped, because it was a wrong approach. However, we soon will re-introduce the property to allow developers to force _no_ editor on input format enabled textareas (but not the opposite).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

reddyweb’s picture

Issue tags: +#wysiwyg filters

For your custom textarea field you must add this line, to use the default input format (Full HTML):

$form['format'] = filter_form();

be careful if you use this form element inside fieldset you must include this fieldset:

$form['page-info']['format'] = filter_form();