4

I enabled the CkEditor module, which is now affecting all the form elements with a summary and a input format fields.

Is there a way to avoid CkEditor is used for some form elements, for example the body form element used for nodes?

2 Answers 2

5

The problem you experienced with configuring the field is that in core there is no option to select the allowed text formats. When this module is installed

https://www.drupal.org/project/allowed_formats

you can select the text format that is available for a specific field and then you can choose in the settings of the text format whether to use ckeditor or not.

There is work going on to put this in core: https://www.drupal.org/node/784672

0

For body you can use next code:

function YOURMODULE_form_node_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id == 'YOUR_FORM_ID'){
    $form['body']['widget']['#after_build'][] = '_remove_body_wysiwyg';
  }
}

function _remove_body_wysiwyg($form_element, \Drupal\Core\Form\FormStateInterface $form_state) {
  if (isset($form_element[0]['#pre_render'])) {
    unset($form_element[0]['#pre_render']);
  }
  return $form_element;
}

Your Answer

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