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
When saving a field translation, a notice pops up, Notice</em>: Undefined index: field.storage.node.field_name in Drupal\config_translation\Form\ConfigTranslationFormBase->submitForm() (line 203 of /.../core/modules/config_translation/src/Form/ConfigTranslationFormBase.php).'
I can't find an issue related to this and I don't think it's any of the settings I've used.
Proposed resolution
Make sure the config is not set for form values that are not posted.
Comment | File | Size | Author |
---|---|---|---|
#28 | configuration-2746253-28.patch | 3.4 KB | eiriksm |
#18 | configuration-2746253-18.patch | 2.86 KB | borisson_ |
Comments
Comment #2
Leksat CreditAttribution: Leksat at Amazee Labs commentedThe bug exists in all 8.x branches.
I added a comment to the patch.
Comment #3
Leksat CreditAttribution: Leksat at Amazee Labs commentedComment #4
nevergone CreditAttribution: nevergone commented#2 tested and works well: notice is not exist!
Comment #5
nevergone CreditAttribution: nevergone commentedComment #6
alexpottLooks like we're missing test coverage then.
Comment #7
borisson_I added a test, the test-only patch also serves as an interdiff. I wrote this test while mid-air on my way to dev days milan, so I hope it's good enough, this isn't the easiest place to focus ;).
Comment #10
pguillard CreditAttribution: pguillard commentedIn fact this patch applies to 8.2, and does not applies to 8.1.
In my opinion this ticket should target 8.2 first, and then be moved to 8.1. I am wrong ?
I guess we need @alexpott 's opinion.
Comment #11
borisson_Retested with 8.2.x, also changed the targeted version.
Comment #13
borisson_Test only patch fails as expected, the patch with the code included passes for 8.2 as well. Do I need to make another patch for 8.1 or is it fine to get this in for 8.2 first?
Comment #14
borisson_I created a patch for 8.1 and 8.2, attached both.
Comment #16
RoloDMonkey CreditAttribution: RoloDMonkey at FFW commentedTo me, this seems to fit the definition of a Major bug.
Comment #17
XanoThis is a minor bug, because PHP notices do not break anything, and as far as I can see nothing's buggy apart from the notice.
I think this is almost ready to be RTBC'd. However, the newly introduced test method must also confirm the existence of the new translation.
Comment #18
borisson_Fixed #17.
Comment #20
Arne Slabbinck CreditAttribution: Arne Slabbinck as a volunteer commentedAt some point in configuring my Drupal 8 site I experienced the same Notice, but the field wasn't translatable anymore to other languages.
I can confirm the patch in #18 (configuration-2746253-14--d8.1.patch) resolved this issue (using Drupal 8.1.8)
Comment #21
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedRTBC.
PS: I do consider this a major issue. Not because of the notice but because it prevented saving and thus translating a label. In my case I had a non-translatable field (value) with a label that needed translating.
Comment #22
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedComment #23
cilefen CreditAttribution: cilefen as a volunteer commentedExceptions are thrown.
Comment #24
alexpottMaybe we can do this better by doing:
foreach ($form_values as $name => $value) {
And then doing
$element->setConfig($base_config, $config_translation, $value);
It's great to see a test. I've confirmed it fails without the fix.
Comment #25
mogio_hh CreditAttribution: mogio_hh commentedWill this be fixed in the next Drupal version? Do I need the patch or can I wait?
Thanks
Comment #27
TrevorBradley CreditAttribution: TrevorBradley commentedFix worked for me.
Comment #28
eiriksmFixed per comments in #24
Comment #29
Utilvideo CreditAttribution: Utilvideo commentedTested, worked
Comment #30
flocondetoile#28 fix the issue and I can now translate fields label.
Comment #31
mpp CreditAttribution: mpp as a volunteer and at AmeXio commentedComment #32
alexpottCommitted and pushed 240524f to 8.4.x and fb8b2ce to 8.3.x. Thanks!
Thanks to everyone for all the comments confirming the fix works. I credited myself because my comment in #24 directly changed the patch.