The following error happens when trying to create a translation for a content type where a color field is not translatable, and it has no default value.

Non-translatable fields can only be changed when updating the original language

In multilingual content type, with a non-translatable color field where no default color has been set, it is not possible to create a translation because the constraint EntityUntranslatableFieldsConstraintValidator fails when comparing opacity component of the original content with the new one. When comparing, the original value for opacity exists in the values array of the field, with NULL, but the opacity component in the values of the translation entity is not defined. Therefore, the validation fails making it impossible to translate content.

Curiosly, if a default color value is defined, the validation works well. So it would be nice if it was possible to define a default opacity, with no color default.

Another way to resolve this issue I've found is by adding the opacity component to the form, with #type value and #value set to NULL. This gives the correct NULL value for opacity when the validation is executed, and then it works and it is possible to save the translation.

I'll post a patch for this...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

markus_petrux created an issue. See original summary.

markus_petrux’s picture

Status: Active » Needs review
FileSize
514 bytes

Patch attached.

NickDickinsonWilde’s picture

Status: Needs review » Fixed

Thanks for the patch! Committed.

Status: Fixed » Closed (fixed)

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