Background

We are using paragraphs with an entity reference field and translations. On the entity reference field we were not able to reference a translated node in the translated language.

i.e.
EN node, paragraph with entity reference field can reference an EN node.
FR translation, paragraph with entity reference field can NOT reference the ref node with the FR translation. It is only aware of the EN base language.

https://www.drupal.org/project/translated_entityreference resolved that issue by making the entity reference field aware of the FR translation on the ref node.

However:

While we could then reference the node within the paragraph, it did not render in the widget preview or on the node view.

$langcode was not being passed to the view method in ParagraphsItemEntity, so was being set to LANGUAGE_NONE. Will attach a patch that adds $langcode in paragraphs_field_formatter_view as well as paragraphs_field_widget_form_build.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sleepingmonk created an issue. See original summary.

sleepingmonk’s picture

sleepingmonk’s picture

sleepingmonk’s picture

Issue summary: View changes
tanc’s picture

I noticed a similar issue where we have a translatable field which isn't displayed as the $langcode isn't passed through to the view method. The patch in #2 fixes this in my case.

jeroen.b’s picture

Status: Active » Needs work

Thanks for putting effort and time into this!

I'm currently trying to get the quality of the code up to par with the D8 version.
That mostly just means we need to add many tests to make sure we won't break anything.
Are you able to create a unit test for this? (and provide 2 patches: 1 with the fixed code + test, 1 with the test only. that way we can see the test actually confirms it is fixed now).

Raphael Apard’s picture

+1

kristiaanvandeneynde’s picture

Priority: Normal » Major
Status: Needs work » Reviewed & tested by the community

This actively breaks the combination of Paragraphs+Title+Entity translation since a recent update in ET. Translated titles just don't show up at all. The patch fixes this. While I encourage test coverage (and definitely for D8), I'd say this patch is too important to hold off for D7.

In order to create a proper test for this, you'd need to somehow recreate the exact same circumstances under which a site behaves when the above 3 modules are enabled. I think hell would freeze over long before anyone here even thinks of touching that with a ten-foot pole.

jstoller’s picture

Status: Reviewed & tested by the community » Fixed

Patch committed to dev.

  • jstoller committed 3d44451 on 7.x-1.x authored by sleepingmonk
    Issue #2645646 by sleepingmonk: Translated node reference in paragraph...

Status: Fixed » Closed (fixed)

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