I know that content entities should be translatable. However, there are situations it is not. For example, the Profile module decided to make its entities nontranslatable - I hope they change it here.

To allow entities like these to be synchronized, the Entity Share module should not require a language to be set for the content.

Comments

dbiscalchin created an issue. See original summary.

dbiscalchin’s picture

A patch that makes the module work with entities that do not have a language code.

I've also fixed a part of the code where the "langcode" key was not being verified - it was assumed that it would be "langcode", but it may vary for different entity types.

dbiscalchin’s picture

The previous patch was not working for updates of nontranslatable entities.

grimreaper’s picture

Priority: Normal » Major
Status: Active » Needs review
Related issues: +#2939827: Provide a supported API for entity denormalization

Hello,

Thank you very much for opening this issue.

With Drupal 8 and the new multilingual API, I didn't imagine untranslatable entities (and therefore entities without langcode).

I will not merge or test your patch because #2939827: Provide a supported API for entity denormalization has a higher priority. And so I will wait for it to be done before checking your issue.

Also changing the status to needs review as there is a patch and puting a higher priority.

dbiscalchin’s picture

Sending a new patch, because sometimes the "langcode" key comes as an empty string.

grimreaper’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Assigned: Unassigned » grimreaper
Status: Needs review » Needs work
grimreaper’s picture

Status: Needs work » Needs review
StatusFileSize
new4.26 KB

Hello,

@dbiscalchin, thanks for the patch.

Unfortunately, as the patch is old it can't be appliable anymore. I looked into the patch and I think some implementation can lead to side effects.

Here is a patch with a new implementation. Testing, with the profile entity from https://www.drupal.org/project/profile, I also fixed the problem of an entity without 'label' entity key.

Also during my testing with a profile entity, I had to add:

      unset($entity_data['attributes']['data']);

because I think it was a computed field which can't be handled by FieldItemNormalizer.

I will try to create a dedicated untranslatable entity for test and also to write a test.

Meanwhile, this patch allows to unlock the situation on entity share 8.x-2.x.

grimreaper’s picture

Patch with the automated tests and the fix which should be green.
Patch with the automated tests only which should be red.

Status: Needs review » Needs work

  • dbiscalchin authored 1ffbc44 on 8.x-2.x
    Issue #2996220 by dbiscalchin, Grimreaper: Allow nontranslatable...
  • Grimreaper authored 4202b67 on 8.x-2.x
    Issue #2996220 by dbiscalchin, Grimreaper: Allow nontranslatable...
grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Needs work » Fixed

Merged!

Status: Fixed » Closed (fixed)

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