Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Visibility settings have changed in D7 so it's now set per input format.
However, can one still disable ckeditor for certain textareas?
The case is when a cck field has 'filtered text' type input.
This creates a ckeditor instance on the form.
I'd rather a plain textarea that accepts some html. In this case it's a postal address.
thoughts?
DT
Comment | File | Size | Author |
---|---|---|---|
#4 | ckeditor-hook-to-disable-wysiwyg-1145132-4.patch | 1.25 KB | Pete B |
Comments
Comment #1
dczepierga CreditAttribution: dczepierga commentedHi,
For now it's impossible to do that... This option (include/exlude from textareas) will be released with version 7.x-2.x of CKEditor module.
So pls be patient.
Hint: U could try also to disable it in ckeditor.module.php by adding special peace of code, that check the field name and then exit from function - so then CKEditor library would't be attached there.
If u have any questions pls reopen this issue.
Greetings
Comment #2
davidwhthomas CreditAttribution: davidwhthomas commentedThanks for the earlier reply, just an update on this if anyone else is looking.
In the meanwhile, in order to disable ckeditor autostart for a specific textarea, you can use javascript and go:
In this case field_subheading
To disable ckeditor entirely on a field, it looks like one could use
hook_element_info_alter
and replace the ckeditor pre_render functionckeditor_pre_render_text_format
with a clone copy that checks for specific fields. See ckeditor.module ~line 209 for more infohth,
DT
Comment #3
jcisio CreditAttribution: jcisio commented#1063986: Allow user to choose which textarea is enable by default
Comment #4
Pete B CreditAttribution: Pete B commentedThe original issue describes a use case which is not a duplicate of #1063986. Namely disabling with no option to enable (instead of disabling by default, but allowing to enable.)
I'm interested in the behaviour described here too. I have a field where I never want CKEditor to appear.
I would like to request a simple change to ckeditor_load_by_field() to add the following lines:
Then I could use:
to disable CKEditor for my field.
Comment #5
Pete B CreditAttribution: Pete B commentedComment #6
rudiedirkx CreditAttribution: rudiedirkx commentedI think a hook is too expensive, and it misses a lot of context.
$field
is not enough to know exactly where you are.My approach in #2530324: Allow lazy loading per-element CKEditor by element #property was the other way around: alter a form, add a property, CKEditor will read that property when it's time to decide to enable the editor. Advantage: 100% context, because custom form alter. Disadvantage: lots of form alters if you're disabling many editors in different locations.
And a tiny bit of code review: if the hook doesn't return anything (
NULL
), it'll disable the field, becauseNULL == FALSE
.Comment #7
rudiedirkx CreditAttribution: rudiedirkx commentedActually, this issue might be about completely disabling CKEditor for one element. My issue was about only disabling
autostart
.Comment #8
daniel.nitsche CreditAttribution: daniel.nitsche as a volunteer commentedIt's a bit cheeky, but if you add a class of "ckeditor-processed" to the textarea and the parent div, ckeditor won't attempt to load for that field.
Comment #9
sumanthkumarc CreditAttribution: sumanthkumarc as a volunteer commentedWas looking for solution to disable ckeditor for my comment body field and #2 comment above helped me.
I found that ckeditor doesn't load if the attribute #format is unset, so did following in my pre_render function. Also i did array_unshift so that my function is at top.
unset($element['#format']); // ckeditor doesn't load if this is unset
Comment #10
rubenvarela CreditAttribution: rubenvarela commentedIn case it helps someone. Meanwhile, what I did to disable it on a field is the following.
- Things that need to be changed,
FORM_ID
,FIELD_TEXT
,BUNDLE_NAME
- Assumption,
LANGUAGE_NONE