Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The Paragraphs module is not working correctly with preview.
Only title is translated and paragraphs not.
Comment | File | Size | Author |
---|---|---|---|
#5 | integration_with-2667802-5-interdiff.txt | 5.01 KB | Berdir |
#5 | integration_with-2667802-5.patch | 4.03 KB | Berdir |
| |||
#4 | integration_with-2667802-4.patch | 3.09 KB | thenchev |
| |||
#3 | paragraph-2667802-3.patch | 1.46 KB | CTaPByK |
| |||
Screen Shot 2016-02-12 at 4.42.53 PM.png | 363.27 KB | CTaPByK |
Comments
Comment #2
CTaPByK CreditAttribution: CTaPByK at MD Systems GmbH commentedComment #3
CTaPByK CreditAttribution: CTaPByK at MD Systems GmbH commentedI'm not do so much here, i try to make this method to be non recursive, but i stuck with translation->get() and offset, i cant get right field to set translation. I will continue with this later.
Comment #4
thenchev CreditAttribution: thenchev at MD Systems GmbH commentedHere is some test coverage.
Maybe i didn't understand correctly about the test. In testEmbeddedReferences i used reference field to test if they are working but seems they are. Should I add paragraph as dependency to test it directly? I can redo the test...
Comment #5
BerdirFun. The test isn't failing because there's nothing to fail. This works perfectly fine with nodes and normal entity references.
Took me a while to debug, but what's special about paragraphs is that they're not in entity reference fields. They're in entity reference *revision* fields. And those have some copy & pasted code that breaks what we are doing: #2672206: EntityReferenceRevisionsFormatterBase::prepareView() is blindly copied and lies
With that patch, it works perfectly... For entity revision reference fields and any entity type that has static caching enabled. See the additional comments and @todo. We should probably open a follow-up for that.
I also made some improvements to the test. We already have the fields and embedded field configuration, so we don't need that. We just need the entity view display configuration (which I switched to entity view so that we can test the body too) and creating the content + job + preview. With this setup, we could even test a nested child as well.
Changing this to a task for writing test coverage as there is no bug here.
Comment #6
BerdirComment #7
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedTest looks good to me and patch in entity reference revision makes sense. Should we get this in and open a follow-up for @todo?
Comment #8
BerdirAgreed. Created to follow-up: #2673078: Use "new entity" logic to ensure that prepareView() doesn't replace prepared translations.
Comment #10
BerdirStill applied with git apply -3, even though the cache part already got in with #2682589: Preview not invalidated on change