WYSIWYG editor without input filter dialog?

Events happening in the community are now at Drupal community events on www.drupal.org.
ralphb's picture

Hello,

I have a custom node content type with multiple text areas. The input filter for those textareas should be fixed ("Filtered HTML"), so I don't want to show the filter selection dialog in my form.

$form['set']['f1']['f1'] = array(
    '#type' => 'textarea',
    '#title' => 'Title',
    '#default_value' => $node->f1,
  );
$form['set']['f1']['format'] = filter_form(4, NULL, array('f1_format'));  // don't want this!

How can I get WYSIWYG to work on those textareas despite the missing input filter selection?

Ralph

Comments

Figured out?

perceptum's picture

Hi,

Did you figure this out?

Bryan

--
Bryan Gruneberg
Chief ninja in charge at Perceptum Thought Squad

Google Talk bryan@perceptum.za.net
Skype perceptum-ts

IRC Chat

perceptum's picture

Had this chat about wysiwyg on IRC.

perceptum: by design
seutje - I dont follow?
perceptum: wysiwyg api was designed to be attached to input formats
seutje - oh right
I understand
thanks for that
I can actually use filters - so its cool
but a user with only the permission to use the default input format won't get the list of input formats
but they'll still get the editor associated with that format
if that makes sense
seutje - yeah - I think that does ja
Im gonna test it now!

--
Bryan Gruneberg
Chief ninja in charge at Perceptum Thought Squad

Google Talk bryan@perceptum.za.net
Skype perceptum-ts

Basicly working

perceptum's picture

Ok - got this working, pretty much

$format = filter_format_load(6); // 6 = my input filter I want selectd

$form['questions'][$weight][$cnt]['format'][6] = array( // Yes - the 6 is important here
'#type' => 'value', '#value' => $format->format, '#parents' => array('0'=>'format')
);

// This next line seems to be required by wysiwyg module - without it nothing happens
// but it doesnt put anything on the form because the #value can be blank! yay!
$form['questions'][$weight][$cnt]['format']['format']['guidelines'] = array('#title' => 'Formatting guidelines', '#value' => '');

Thanks to @TwoD on #drupal for his suggestion to look at the core filter module

--
Bryan Gruneberg
Chief ninja in charge at Perceptum Thought Squad

Google Talk bryan@perceptum.za.net
Skype perceptum-ts

Wysiwyg

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: