Problem/Motivation
After updating to Drupal 10.3, I cannot update a text format without this error:
The website encountered an unexpected error. Try again later.
Symfony\Component\Validator\Exception\LogicException: The LangcodeRequiredIfTranslatableValues constraint can only operate on the root object being validated. in Drupal\Core\Config\Plugin\Validation\Constraint\LangcodeRequiredIfTranslatableValuesConstraintValidator->validate() (line 26 of core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/LangcodeRequiredIfTranslatableValuesConstraintValidator.php).
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(Array, '00000000000008be0000000000000000', Array) (Line: 154)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 106)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 93)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 132)
Drupal\Core\TypedData\TypedData->validate() (Line: 234)
Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair(Object, Object) (Line: 680)
Drupal\ckeditor5\Plugin\Editor\CKEditor5->validateConfigurationForm(Array, Object) (Line: 207)
editor_form_filter_admin_format_validate(Array, Object)
call_user_func_array('editor_form_filter_admin_format_validate', Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 274)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'filter_format_edit_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('filter_format_edit_form', Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('filter_format_edit_form', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Since that doesn't explicitly identify which module was causing the problem, I had to trial and error uninstalling any ckeditor-adjacent until I determined that it was coming from both ckeditor_indentblock (already had an issue logged here: https://www.drupal.org/project/ckeditor_indentblock/issues/3457094) and from ckeditor_codemirror.
Steps to reproduce
- Drupal 10.3
- PHP 8.2 (probably doesn't matter)
- CKEditor CodeMirror enabled
- Try creating or editing a text format that includes CKEditor
- It does not matter if CodeMirror highlighting is enabled or not on that format
Proposed resolution
I am not knowledgeable enough about CKE5 plugins to know where to start with this, but you can possibly coordinate with the ckeditor_indentblock developers having the same issue.
Issue fork ckeditor_codemirror-3457347
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
solideogloria commentedComment #3
solideogloria commentedComment #4
solideogloria commentedIn case the module does happen to be the cause of an error, I will ask for more info. The Drupal Core issue and patch are just (essentially) workarounds that change an Exception into a triggered error. However, I use this module and don't have any issues in 10.3, even without the patch from the Core issue.
Comment #5
alexpottYes this module does cause the error. It is incorrectly assigning config_object to seomthing that should be a mapping
https://git.drupalcode.org/project/ckeditor_codemirror/-/blame/3.0.x/con...
Looking at core you see mapping for ckeditor plugins
While we might rollback the exception in Drupal 10.x it will be quicker a better to fix this in this module ASAP.
Comment #7
alexpottComment #8
ryan-l-robinson commentedThe proposed change fixes the problem for me.
Comment #9
solideogloria commentedApplies and works for me.
Comment #10
vincent.hoehnI can also confirm that this resolves the problem.
Comment #11
wellsMerged. Thanks, all!
Comment #12
solideogloria commentedDid you set issue credit? I don't see any users credited.
Comment #13
wellsNo, sorry about that. I merged in GitLab and for some reason had in my head that it does that automatically but it does not. I think there is some way for DO admins to amend that? @alexpott?
Comment #14
alexpott@wells nah it's a commit... no way to change that git history now without doing silly things. I think credit on the issue is fine.
Comment #15
alexpott@wells if you select the people to credit on the issue, save and then use the merge button on the issue everything is as you would expect. If you use the merge button on gitlab then you need to bring fix up the commit message.
Comment #16
wellsThanks, @alexpott. I get it now. Sorry, all, for the missed credits!
Comment #17
solideogloria commentedNot a problem. It is showing on my Drupal profile.