Disable wysiwig editor (CKEditor) for node body summary field.

Public

Disable wysiwig editor (CKEditor) for node body summary field.

</> CopyGet raw version
php
  1. /**
  2.  * Alter form existing by $form_id.
  3.  */
  4. function mymodule_form_alter(&$form, &$form_state, $form_id) {
  5. // Disable wysiwyg editor (CKEditor) for summary node field.
  6. if (isset($form['body'][LANGUAGE_NONE][0]['summary'])) {
  7. $form['body'][LANGUAGE_NONE][0]['summary']['#wysiwyg'] = FALSE;
  8. }
  9. }

Comments

andyg5000's picture

Thanks! Here's an updated slightly more robust version that doesn't hardcode the language.

  1. /**
  2.  * Implements hook_form_alter().
  3.  */
  4. function mymodule_form_alter(&$form, &$form_state) {
  5. if (!empty($form['body'])) {
  6. $language = $form['body']['#language'];
  7. foreach (element_children($form['body'][$language]) as $key => $value) {
  8. $form['body'][$language][$key]['summary']['#wysiwyg'] = FALSE;
  9. }
  10. }
  11. }