A warning will show up for every field that is empty in the original node when trying to translate it, like this:
Notice: Undefined index: ar in EntityTranslationDefaultHandler->setTranslation() (line 662 of PATH/modules/contrib/entity_translation/includes/translation.handler.inc).
The actual code is checking if the field exists (it will), but if the field is empty, there will be no language code:
if ($field['translatable'] && isset($values[$field_name])) {
$this->entity->{$field_name}[$langcode] = $values[$field_name][$langcode];
}
The if sentence should check also if the language code exists:
if ($field['translatable'] && isset($values[$field_name][$langcode])) {
This doesn't seem to do any harm at all besides the warning.
Comment | File | Size | Author |
---|---|---|---|
#16 | entity_translation_php_warning_2824255_7.patch | 731 bytes | plach |
|
Comments
Comment #2
ccarrascal CreditAttribution: ccarrascal commentedComment #3
ccarrascal CreditAttribution: ccarrascal as a volunteer commentedComment #5
ccarrascal CreditAttribution: ccarrascal as a volunteer commentedPrevious patch failed testing, so this is a new approach to remove the warning.
Comment #6
ccarrascal CreditAttribution: ccarrascal as a volunteer commentedComment #8
ccarrascal CreditAttribution: ccarrascal as a volunteer commentedThis one is an empty patch because all the previous test are failing... just to be sure that is not my fault :-(
Comment #9
ccarrascal CreditAttribution: ccarrascal as a volunteer commentedComment #11
ccarrascal CreditAttribution: ccarrascal as a volunteer commentedOk, I will go back to my original patch, because I can see that all the patches are failing to pass right now, and it is not related to this.
I am setting the issue as needs review and disabling more automated testing for this small patch.
Comment #12
ccarrascal CreditAttribution: ccarrascal as a volunteer commentedComment #13
henriquebauer CreditAttribution: henriquebauer commentedIt's working for me.
Comment #14
henriquebauer CreditAttribution: henriquebauer commentedComment #15
plachLet's try again
Comment #16
plachnow with patch
Comment #18
plachCommitted and pushed, thanks!