0

I am developing a custom module with some entities inside. I created a form to edit them and I would like to use CKEditor in one of the fields.

I can see and use the CKEditor, but when it's time to save, it always saves the value 'Array'. You can find the code I am using below:

$form['description'] = array(
        '#type' => 'text_format',
        '#format' => 'full_html',
        '#title' => t('Content'),
        '#default_value' => $entity->content,
        '#weight' =>2,
        '#required' => FALSE,
    );

I'd say CKEditor changes the value before sending the form POST but I am not sure.

Any ideas?

1

Ok, that was easier than I thought. When using WYSIWYG editors you have to save the info differently.

For a normal textarea:

$entity->content = $form_state['values']['description']

For a WYSIWYG:

$entity->content = $form_state['values']['description']['value']

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.