Steps to reproduce:

  • create a new node of a type where entity_translation is used for translation and leave it as 'unpublished' (table 'node', column 'status' = 0)
  • add and save a translation
  • now publish the original node (table 'node', column 'status' = 1)

Result:

  • the translation status of the original language version remains at 'unpublished' (table 'entity_translation', column 'status' = 0)
  • the translation status of the translated language version is at 'published' (table 'entity_translation', column 'status' = 1)
  • anonymous users can not see the original language version of the node
  • there is no way from the interface to set the translation status to published

Expected behavior:
The translation status of the original translation should switch to 'published' when the node itself switches from unpublished to published.

Comments

laur3ntlapo’s picture

Same issue.

drewmacphee’s picture

Same

reglogge’s picture

Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new697 bytes

Here's a first patch, which is probably totally wrong - but it works...

I added a function using hook_node_update() to update the entry in the table entity_translation to mirror the translation status to the publications status of the node.

This probably needs to be expanded to cover all possible entities.

Also setting the priority to major, since there really is no way to publish a translation when the node was originally saved as unpublished. And since that seems to me to be a fairly normal workflow for editors (save a first draft without publishing, working on the content, and finally publishing it) that's a real problem.

reglogge’s picture

Issue tags: +Needs tests

And this of course needs a test. Tagging.

plach’s picture

I remember to have coped with this while working on the new UI. Please check the ml_edit_form branch and see if it fixes your issue.

plach’s picture

Status: Needs review » Postponed (maintainer needs more info)
longwave’s picture

Status: Postponed (maintainer needs more info) » Needs review

Patch in #3 works for me, although the query should also include a condition for entity_type == 'node'.

I was testing this while the last two comments were posted, and haven't had a chance to look at the branch yet.

longwave’s picture

Status: Needs review » Postponed (maintainer needs more info)

Resetting issue status

reglogge’s picture

Testing with branch ml_edit_form.

- The links for adding a translation or editing the node from /node/xxx/translate are broken in that branch. They just lead to /node/xxx. So it's not possible to create translations for testing purposes.
- However, changing he status of the node from its regulare node/xxx/edit form now also changes the value of the status column in entity_translation table

So, the issue seems to be at least partly fixed in ml_edit_form, as far as can be tested without being able to create translaitons. It would be interesting to see if the status of translations also changes along with the status of the original node.

longwave’s picture

Posting to note that this patch significantly impedes performance when importing nodes with migrate, this can be alleviated by adding ->condition('entity_type', 'node') to the query.

reglogge’s picture

Status: Postponed (maintainer needs more info) » Needs work

Setting back to needs work, since it's been established that the issue is at least partly resolved in branch 'ml_edit_form'.

@plach: Can you point me in the right direction as to what you did in that branch that resolves the issue? I would then proceed to roll a new patch against current HEAD to incorporate this and if needed also longwave's comment in #10.

ioannis.cherouvim’s picture

Component: Code » Base system

For me this also affects content types with "node translation" and not only content types with "entity translation". The entity_translation.status remains 0.

das-peter’s picture

Status: Needs work » Needs review
StatusFileSize
new776 bytes

Updated the existing patch since the question in #11 is still open.
Added the entity type condition as suggested by longwave, as this is not only performance relevant but critical. Without this conditions the status of an entity other than node but with the same id would be overwritten.

plach’s picture

#1495648: Introduce entity language support is going to land soon. After that happens I will roll a new alpha and then commit the new UI patch. Please confirm #13 works so this can go into the alpha 2 which will be the latest release featuring the old UI. This should be already fixed in the new ml_edit_form branch.

@#13

Can't we solve this at form level instead that afer saving the node?

das-peter’s picture

Can't we solve this at form level instead that afer saving the node?

The question is if the translation status (of the original language) is really related to the entity status. The status of the other languages isn't related to the entity status.
Shall it be possible to unpublish the translatable fields (translation status) while the untranslatable fields still are published (entity status).
If so, I suggest to add a form element ($form['translation']['status']) to configure this setting in entity_translation_form_alter() and of course all the code to handle this.

Btw. related to the version switch to the new ml form branch:
Wouldn't it be better to be bold and create for this a new major version?

  • 7.x-1.x for maintaining a version before Drupal Core version 7.x
  • 7.x-2.x for the new recommended version after Drupal Core version 7.x (ml form)
plach’s picture

@das-peter:

Wouldn't it be better to be bold and create for this a new major version?

It's not matter of boldness but time availability: it's already very difficult for me to maintain one branch of ET and work on D8 core. I simply wouldn't be able to maintain two different branches.

The core patch has landed, so expect a new alpha to be released soon and the new UI committed :)

das-peter’s picture

@plach: okay I see the issue. And I just read the core ticket is fixed - congrats! *yay*

das-peter’s picture

I gave the suggested approach in #15 a shot.
Doing so I came across an possible issue in entity_translation_edit_form_save_submit().
The function reuses the translation handler from $form['#handler'], unfortunately this handler doesn't reflect the latest state of the handler. E.g. the "correct" handler returns TRUE for $handler->isTranslating() the handler in the form doesn't.
This leads to triggering EntityTranslationDefaultHandler::setOriginalLanguage() every time a translation is saved.

The patch also contains a possible API change since EntityTranslationDefaultHandler::getStatus now returns the set translation status and not the entity status. (Not sure if this deserves a new function)

Would be nice if we could fix this in the old version before the new approach is merged.

plach’s picture

Status: Needs review » Closed (won't fix)

I'm sorry but with this patch we would be diverging too much from the currest master branch behavior. We would risk to introduce more errors which would not be fixed in the dev release, since it will be largely different. People needing this fixed will have to use the new UI.

cweagans’s picture

Is there any way that the patch in #13 could be reconsidered? We have been using it on a client project for some time now and it'd be very nice to get into the next alpha. I won't change the status on the issue, but I'd really appreciate it if you'd consider it :)

plach’s picture

Is there any way that the patch in #13 could be reconsidered?

Nope, sorry. There won't be another alpha: the current dev release will become a beta very soon: #1624830: Plan for Entity Translation 7.x-1.0 release and AFAIK this bug is fixed in the dev version. Everyone is encouraged to test the lastest dev so that unpleasant surprises won't come out when installing the beta.