When creating a node with a CCK textarea field, is there a way to restrict the selection of input formats? The only choices I can find are “Plain text” and “Filtered text (user selects input format)”. If I choose the latter, the user gets to choose any input format available to the user, even those that aren’t appropriate for the field.

When configuring the field, I expected to see the same list of input format checkboxes that I see for the main “Body” field.

Comments

Zero4ffect’s picture

You can accomplish this to some degree with the Better Formats module located at http://drupal.org/project/better_formats.
Although with this you cant have multiple text areas on the same form with different input formats (which is what I am currently struggling with).

Best of luck,
- RCube

beyond67’s picture

Im interested in this also.

pedrosp’s picture

Subscribing too

candelas’s picture

Category: support » feature

subscribing
i change to feature request :)
thanks for the module.

in my case is for making a field that links videos.

xrampage16’s picture

This thread is quite old, but I was looking around for a solution and came upon this page, so am guessing that some others might as well.

One of the methods that you can take, is using hook_form_alter() on that particular form (in my case, a node form) that you wish to restrict the input filters.

You have to do more than a traditional hook_form_alter, as the input filters are added later on, so you have to make the changes by making use of the #after_build using formapi.

Inside of hook_form_alter, after you have selected the particular form_id, you can add your own method to #after_build...

for instance....
$form['#after_build'][] = 'my_module_form_after_build';

then also add to your custom module

function my_module_form_after_build($form_element, &$form_state) {
//dig through your form and unset the input filters that you wish to remove.
return $form_element;
}

make sure that if you remove the default input filter, than you set a new #default_value/#value, so that an input filter is selected by default.

for instance...

$form_element['group_my_story']['field_my_story'][0]['format'][$value]['#default_value'] = $value;
$form_element['group_my_story']['field_my_story'][0]['format'][$value]['#value'] = $value;
$form_element['group_my_story']['field_my_story'][0]['#value']['format'] = $value;
$form_element['group_my_story']['field_my_story'][0]['#default_value']['format'] = $value;

otherwise the textarea will load without a radio button being selected, which could lead to potential issues.