Comments

jibla created an issue. See original summary.

berdir’s picture

That is a feature, not a bug.

Paragraphs are part of the host entity, if you translate a node with paragraph fields, they are automatically added there.

jibla’s picture

Uploading the patch.

jibla’s picture

Category: Support request » Feature request
Status: Active » Needs review
berdir’s picture

Ah, so what you're saying is that saving doesn't work.. that is possible, looking at that code. But then you should clarify the issue title.

jibla’s picture

ademarco’s picture

Yeah the problem is that the default embedded fields are not loaded in \Drupal\wfp_global\Plugin\tmgmt\Source\ContentEntitySource::doSaveTranslations() since only those saved in configuration are:

$embeded_fields = \Drupal::config('tmgmt_content.settings')->get('embedded_fields');

ContentEntitySource::doSaveTranslations() should instead use:

 $embeded_fields = $this->getEmbeddableFields($entity);

The patch does just that.

ademarco’s picture

Status: Needs review » Reviewed & tested by the community
berdir’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Makes sense, but we need to figure out why our tests aren't catching it. We do have tests, maybe only for extracting, not sure.

miro_dietiker’s picture

Priority: Normal » Major

I also once ran into saving issues but wasn't able to reproduce it well... Happy we found this problem.

Promoting since Paragraphs is our reference UX demo case.

ademarco’s picture

In tmgmt_demo_install() we run the following:

  if (\Drupal::moduleHandler()->moduleExists('paragraphs_demo')) {
    \Drupal::configFactory()->getEditable('tmgmt_content.settings')
      ->set('embedded_fields.node.field_paragraphs_demo', TRUE)
      ->save();
  }

This actually saves that "entity_reference_revisions" into "tmgmt_content.settings", something that you can never do via the UI. I haven't tried it but I bet that if we remove that part from the hook_install() the demo module would not work anymore.

About tests: the only one I could find that concerns this issue seems to be:

\Drupal\tmgmt_content\Tests\ContentEntitySourceTranslatableEntityTest::testTranslatableEntityReferences()

But there we don't test saving a translation but only if the job item can correctly derive a referenced entity (which it can), or where should we look at to find the correct place to test this?

berdir’s picture

You are absolutely correct, that line is a left-over of how it worked before and it needs to go.

And yes, this is the right test. We need to test saving a translation as well, so basically, you call $job_item->acceptTranslation() (possibly in a loop, like most other tests too); and then make sure the translation has been saved as expected. Should just require a few additional asserts there.

chandru225’s picture

I have a similar issue in D7, has anyone tried in a D7 site to translate paragraphs.

toncic’s picture

Assigned: jibla » toncic
Status: Needs work » Needs review
StatusFileSize
new1.74 KB

I think we need more test here.

berdir’s picture

Status: Needs review » Needs work

Not sure where you are going with this. As we discussed, you should extend the referenced test method by accepting the translation there, not define a new one.

miro_dietiker’s picture

Checked the tests quickly and it seems we tried to avoid a test dependency to Paragraphs until now.

Should we add a test combined with Paragraphs?

berdir’s picture

We didn't avoid it, it wasn't necessary as we can use the test entity type that behaves and works the same as far as we are concerned. But the main reason for not using paragraphs before was actually that paragraphs wasn't ready yet when this test was written.

toncic’s picture

Status: Needs work » Needs review
StatusFileSize
new2.28 KB
new3.54 KB
new1.67 KB

I think this is better.

Status: Needs review » Needs work

The last submitted patch, 18: tmgmt_does_not_support-2828017-test-only-18.patch, failed testing.

  • Berdir committed a9ffdaf on 8.x-1.x authored by jibla
    Issue #2828017 by toncic, jibla: TMGMT does not support Paragraphs
    
berdir’s picture

Status: Needs work » Fixed
Issue tags: -Needs tests

Thanks. Remember that test-only patches should always be uploaded first.

Status: Fixed » Closed (fixed)

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

chandru225’s picture

I have a similar issue in in D7, any suggestions?

roderik de langen’s picture

Anyone has any idea about getting this patch for D7?

emb03’s picture

Any work being done on this? This issue is 4 years old. Did this patch ever get ported into a release of the module?

emb03’s picture

Yes, our organization needs this feature too. Please expedite.

berdir’s picture

This is an issue that has been closed 4 years and yes, this has been released also years ago. Recently we've even extended it to cover other forms of paragraph translation. I don't know if you're asking for Drupal 7 or 8, this won't happen for Drupal 7 unless someone is willing to invest a lot of money (we invested weeks of work in Drupal 8 on paragraphs and tmgmt to make this work). If it is not working for you on Drupal 8 then I suggest you double check your paragraph translation configuration (https://www.drupal.org/docs/contributed-modules/paragraphs/multilingual-...), ensure you can translate paragraphs without TMGMT and if all that works, create a support request with more information.

soul88’s picture

This issue is about supporting Paragraphs module in D8. Given the life cycle of D7 version, I have some doubts that such support will be added to D7. Though there are some patches in the issue queue you might want to try: https://www.drupal.org/project/tmgmt/issues/2487874#comment-12187132

Here's some proof that the patch works: https://www.drupal.org/project/tmgmt/issues/3144836

emb03’s picture

@Berdir I will follow the steps you outlined to ensure our paragraphs are being translated correctly to see if that fixes our issue. This is for Drupal 8.9.1. Thanks for the patch.