This is a follow-up issue for #2776665: Support for multi-lingual translations and differing scheduled dates

When scheduled publishing and unpublishing dates are set to be translatable and independent on each translation then this all works fine. However, there is a slight problem when the publish-on date is set to be not translatable - where a scheduled publish-on date entered on one translation is copied to all other translations. This works OK, but our automatic unpublishing of a scheduled node, which is done in hook_node_presave() is only executed for the translation being saved. The status of the other translations is not changed. Hence we can get the situation where a new translation is scheduled to be published, the date is set on the original translation automatically, but it remains published. This could be said to be an admin/setup problem. If you want every translation publish-on date to be synchronised then you should also set the node status to be synchronised too. That solves the problem completely.

A possible solution is to give a message if the dates are synchronised but status is not set to be synchronised. I do not think we should force both settings to match. Adding code to hook_node_presave() to change the status could be done, but that may be over-complex.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Status: Active » Needs review
FileSize
16.21 KB

Finally got round to working on this. Here is an updated Multilingual test, which will fail without the .module changes

Status: Needs review » Needs work

The last submitted patch, 2: 2871164-2.translatable-fields.patch, failed testing. View results

jonathan1055’s picture

Status: Needs work » Needs review
FileSize
28.68 KB

I decided rather than just give a warning if the publish_on date is synchronized but status is translatable, the problem was bigger than this. It involves unpublish_on too, and after a lot of analysis, it became clear that all three fields should either be all translatable (so can vary from translation to translation) or they should all be synchronized over all translations. So this led to adding a validation handler to prevent the form being saved if any of the three fields had a diferent setting to the other two. I have uploaded my notes for the record.

jonathan1055’s picture

Patch with changed to .module for validation, and the updated test.

  • jonathan1055 committed be7ba60 on 8.x-1.x
    Issue #2871164 by jonathan1055: Ensure Scheduler dates and status field...
jonathan1055’s picture

Title: Give warning if publish-on date is synchronized on translations but status is not synchronized » Ensure Scheduler dates and status field have consistent translatable settings
Status: Needs review » Fixed

Fixed.

Status: Fixed » Closed (fixed)

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