Problem/Motivation

When a field is contained in some sort of container entity, such as a field collection or a paragraph, and is rendered in the same form, i18n_field_field_widget_form_alter() will insert the instance information in the location where the field would need to be when it was directly in the node. The specific problem this was causing for me was that it was overwriting the instance information for the same field that was also directly contained in the node, but I can imagine this can have all sorts of interesting effects.

Proposed resolution

Set field instance information using the same functions as used in field_default_form(), i.e. field_form_get_state() and field_form_set_state().

Remaining tasks

  • Write patch (already done, will attach as soon as I have an issue number)
  • Review proposed resolution
  • Write tests

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eelkeblok created an issue. See original summary.

eelkeblok’s picture

Issue summary: View changes
eelkeblok’s picture

Attached is a patch that resolves this problem for me.

idebr’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: i18n-form_state_nested_fields-2685853-2-d7.patch, failed testing.

eelkeblok’s picture

Status: Needs work » Needs review
FileSize
1.04 KB

Shame on me for not having notices turned on in dev. This should make the tests work again.

criscom’s picture

The patch in #6 fixed an issue with the paragraphs module for us where the AJAX handler failed for nested paragraphs fields.