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
Notice appears in logs:
Notice: Undefined index: und in content_translation_language_configuration_element_validate() (line 617 of /var/lib/tugboat/stm/web/core/modules/content_translation/content_translation.module)
Steps to reproduce
- Install Drupal
- Enable Language and Content translation modules
- Go to
/admin/structure/types/manage/page
- In the 'Language settings' tab:
- For 'Default language', select -Not specified- or -Not applicable-
- Check 'Enable translation'
- Save
- Get an error:
"Show language selector" is not compatible with translating content that has default language: . Either do not hide the language selector or pick a specific language.
Proposed resolution
Fix the Undefined array key error so there is no notice in the logs.
Remaining tasks
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#20 | 2994000-9.4.x-REVERT-for-real.patch | 2.74 KB | xjm |
#18 | 2994000-9.4.x-REVERT.patch | 5.84 KB | xjm |
#10 | 2994000-10.patch | 2.39 KB | Lendude |
| |||
#9 | 2994000-9.patch | 2.39 KB | Lendude |
#9 | 2994000-9-TEST_ONLY.patch | 1.43 KB | Lendude |
Comments
Comment #4
pameeela CreditAttribution: pameeela commentedUpdate title with more info and IS with steps to reproduce
Comment #5
codersukanta CreditAttribution: codersukanta at Srijan | A Material+ Company for Drupal India Association commentedI think this is by design and if we allow undefined content to be translated then I see multiple issues to get out of it. If we select -Not specified- or -Not applicable- then as per the current design the validation error message should display as we cant translate content from undefined language.
Comment #6
PasqualleI am not saying Drupal should support this combination, I just wanted to report that the message is wrong and the PHP notice should be fixed.
highlighting problem in the message (with ???), in case it is not clear from the issue description:
Comment #9
LendudeEasily reproduced, easily fixed. Here is a test and fix for this.
Comment #10
LendudeIgnore that fix, this is it.
Comment #12
quietone CreditAttribution: quietone at PreviousNext commentedI applied the patch to D10 and took it for a spin. It works just fine, there are no errors in the log.
Comment #13
quietone CreditAttribution: quietone at PreviousNext commentedToo a closer look at the patch and just a suggested wording change in the comment.
I think this reads better, "Test that we can't use the 'Not specified' default language when it is not showing in the language selector.'
Comment #14
LendudeUpdated the comment.
Comment #15
larowlanNice work folks!
Comment #17
catchCommitted/pushed to 10.1.x and cherry-picked back through to 9.4.x, thanks!
Comment #18
xjmI think this may have broken D9 HEAD.
Comment #19
xjm...Attached the patch to the wrong issue, sorry... It's a revert of https://www.drupal.org/project/drupal/issues/3082211. Still need to see the results, though, so letting it run.
Comment #20
xjmLet's run a revert of this issue itself at the same time just to be sure; I never know what it means when an integer in a D7 migration test changes.
Comment #21
xjmIt was indeed the other issue; sorry for noise!