0

I have a custom form and the following textarea element.

$form['fieldset']['email_template'] = array(
  '#type' => 'textarea',
  '#title' => t('E-mail template content'),
  '#default_value' => '',    
  '#description' => t('A valid template for email trigger.<b>Please type ":" for variable suggestions</b>'),
  '#required' => TRUE,
  '#cols' => 60,
  '#resizable' => TRUE,
  '#rows' => 5,
);

After I installed the CkEeditor module and enabled it, the following text appeared under that form element.

screenshot

I added sky:notification/addTemplate.edit-email-template in the CkEditor module settings as element ID that should use the CkEditor, but the editor is still not used for that element.

How can I enable CkEditor for the email_template element?

1
0

You can just do that by adding '#format' => 'filtered_html' and '#type' => 'text_format',.

1
  • The question was about Drupal 6
    – leymannx
    Aug 23 at 12:46
0

You need to add '#wysiwyg' => TRUE and use 'text_format' for '#type'.

The form element definition would then be the following one, instead of the one you are using.

$form['fieldset']['email_template'] = array(
  '#type' => 'text_format',
  '#wysiwyg' => TRUE,
  '#title' => t('E-mail template content'),
  '#default_value' => '',    
  '#description' => t('A valid template for email trigger.<b>Please type ":" for variable suggestions</b>'),
  '#required' => TRUE,
  '#cols' => 60,
  '#resizable' => TRUE,
  '#rows' => 5,
);
1
  • When i give '#type' => 'text_format' the textarea get disappearing
    – KTM
    Sep 7 '15 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.