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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ccarrascal created an issue. See original summary.

ccarrascal’s picture

Status: Active » Needs review
ccarrascal’s picture

Status: Needs review » Needs work

The last submitted patch, entity_translation_php_warning_761796_1.patch, failed testing.

ccarrascal’s picture

Previous patch failed testing, so this is a new approach to remove the warning.

ccarrascal’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 5: entity_translation_php_warning_761796_5.patch, failed testing.

ccarrascal’s picture

This one is an empty patch because all the previous test are failing... just to be sure that is not my fault :-(

ccarrascal’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: entity_translation_php_warning_761796_6.patch, failed testing.

ccarrascal’s picture

Status: Needs work » Needs review
FileSize
731 bytes

Ok, 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.

henriquebauer’s picture

It's working for me.

henriquebauer’s picture

Status: Needs review » Reviewed & tested by the community
plach’s picture

Let's try again

plach’s picture

now with patch

  • plach committed 9603077 on 7.x-1.x
    Issue #2824255 by ccarrascal, plach: Notice: Undefined index for...
plach’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.