tableau-mkt-archived / entity_xliff

Drupal module that provides an API for entity serialization in the XLIFF format.
https://drupal.org/project/entity_xliff
2 stars 0 forks source link

Support for fields of type "Node Reference" broken #96

Closed iamEAP closed 8 years ago

iamEAP commented 8 years ago

Problem / motivation

If a field of type "Node Reference" (supplied by the node_reference sub-module) exists on a node translated via Content Translation, the translation set of the referenced node will become corrupt after the parent node is imported multiple times. The particular "corruption" is that multiple versions of a piece of content will exist for a given language in a single translation set:

mysql> select nid, type, language, title, tnid FROM node;
+-----+------+----------+---------------------------------+------+
| nid | type | language | title                           | tnid |
+-----+------+----------+---------------------------------+------+
|   1 | page | en       | Parent Node                     |    1 |
|   6 | page | en       | Child Node                      |    6 |
|  46 | page | fr       | Parent Node (FR)                |    1 |
|  47 | page | fr       | Child Node (FR)                 |    6 |
|  48 | page | de       | Parent Node (DE)                |    1 |
|  49 | page | de       | Child Node (DE)                 |    6 |
|  50 | page | fr       | Child Node (FR)                 |    6 | <-- Duplicate FR child node
+-----+------+----------+---------------------------------+------+
7 rows in set (0.00 sec)

In addition to really screwing up underlying reference trees (especially as nested references pile up), it prevents editing a piece of content manually through the UI because of an "invalid" error on the "language" field.

Proposed resolution

The key will be to disable node_reference_field_prepare_translation() in the context of an Entity XLIFF import.

iamEAP commented 8 years ago

Closed in #97.