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.
Problem/Motivation
Whilst creating a new text format with the editor and ckeditor module enabled you can not configure the editor on this form due to:
Uncaught AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /system/ajax
StatusText: OK
ResponseText:
( ! ) Fatal error: Call to a member function getFilterTypes() on a non-object in /Volumes/devdis...<omitted>...4
I guess the issue is that the filter format does not exist yet.
Proposed resolution
Fix bug.
Remaining tasks
Write patch and add test.
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#17 | text_editor_new_format-2207777-17.patch | 9.7 KB | Wim Leers |
Comments
Comment #1
Rajesh Ashok CreditAttribution: Rajesh Ashok commentedCheck if filter format exists, before calling the member functions related to filter format.
Comment #2
Rajesh Ashok CreditAttribution: Rajesh Ashok commentedComment #3
vastav CreditAttribution: vastav commented#1 is working fine for me. Now i am able to add new text format with editor.
Comment #4
Wim Leers#2207777: Can not configure editor whilst creating a new text format was a duplicate of this one.
#1: thanks for working on this! :) And great to see it confirmed in #2 that this fixes the problem. But this still needs test coverage, so back to NW.
Comment #5
Wim LeersThis is a regression caused by #2204129: Store the filter format on the editor entity during runtime.
Test coverage added. Applied the same principle as #1, but I put it in a helper method that makes the code more legible than a
if ($object) {…}
test.We did have test coverage for the generic use case at
EditorAdminTest::testAddEditorToNewFormat()
, but in that case there was no code trying to do things based on the associatedFilterFormat
. Therefore the new test coverage lives atCKEditorAdminTest::testNewFormat()
.Comment #6
Wim Leers#4 was silly, #2229801: Adding text format error for CKEditor is the duplicate.
Comment #8
Wim Leers5: text_editor_new_format-2207777-1.patch queued for re-testing.
Comment #9
Gábor HojtsyLooks good to me, except:
This sounds dangerous, to allow all content by default if there was no filter?! What is the use case for this?
Comment #10
Wim Leers#9: that only happens on the form to configure text formats & text editors. Even then, it only happens if you create a new text format, and before saving that text format, you already associate a text editor.
Plus, this only applies to CKEditor's own filtering. It does not affect what's rendered to end users in any way.
Comment #11
Gábor HojtsyAll right then. Looks good.
Comment #13
Wim LeersTrivial reroll after #2030605: Expand Editor with methods introduced some very minor changes.
Comment #14
webchickSorry, conflicts after CKE 4.4 :(
Comment #15
Anonymous (not verified) CreditAttribution: Anonymous commentedIn Internal.php, generateAllowedContentSetting() was renamed to generateACFSettings()
Comment #17
Wim Leers#13 and #15 included the #2241235: Shortcut/ShortcutSet entity types should use cache tags patch by accident. Proper reroll.
Comment #18
Wim LeersBack to RTBC per #11. This only got marked NW because it didn't apply anymore after #2039163: Update CKEditor library to 4.4 landed.
Comment #19
alexpottCommitted bc5bfc9 and pushed to 8.x. Thanks!
Comment #21
Wim LeersComment #23
damondt CreditAttribution: damondt commentedIt looks like there's a regression for this in Drupal 9. The ajax error is:
Comment #24
amanire CreditAttribution: amanire at Environmental Defense Fund commentedI am also seeing this behavior in Drupal 8.9.13.
Comment #25
tejasvi.c.h CreditAttribution: tejasvi.c.h commented@damondt did you find any solution for this? I'm stcuk with this too.
Comment #26
amanire CreditAttribution: amanire at Environmental Defense Fund commented@tejasvi.c.h If I recall correctly, you have to first add and save the text format. Then go back and edit the CKEditor config.
Comment #27
crutch CreditAttribution: crutch commentedD9 experienced the same #23, #26 is the workaround. Reopen and change to minor?