1

I have a textarea field in a custom module form , I guess there is ckeditor library by default in core in d8 . I tried the following :

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

enter image description here

I followed the link : https://www.drupal.org/node/1031160

But the ckeditor is not applying to the textarea as expected . Any idea ??

UPDATE

I was not given the text_format as ckeditor in https://base_url/admin/config/content/formats . enter image description here I defined a new format which can apply to which all fields needed as ckeditor . cheers

7
  • Any js errors in the console?
    – No Sssweat
    Aug 19, 2016 at 9:50
  • while creating a field text area in any content type ck editor is enabled .?? I aint talking about custom field Aug 19, 2016 at 9:52
  • @ShreyaShetty the field is on a custom module form , not of any content type .
    – KTM
    Aug 19, 2016 at 10:00
  • 1
    No am asking you to do it . So that we can validate if its a problem with ckeditor or the custom module Aug 19, 2016 at 10:15
  • because i tried same code that worked for me . I dunno why it isnt working at your end Aug 19, 2016 at 10:16

2 Answers 2

3

Go to /admin/config/content/formats and check the CKeditor is enabled for FULL HTML. Also, could be a role issue, by default Full HTML is for admins only.

enter image description here

Important:

For safety/security reasons FULL HTML should be used by admins only. You're better off using basic_html as your format if this form is for authenticated or anonymous users. You may need to adjust the roles so anonymous can use it.

3
1
  1. Go to configuration > Click Text formats and editors
  2. you will find Full HTML option click on configure
  3. Select Text editor has Ck Editor and whatever options you want and click on save

Run your code . You will find ckeditor in textarea

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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