Use Case:
As a content producer I would like to be able to schedule moderation state changes for translations so that I can update translations automatically without impacting the original node or other translations.
Issue:
After a fresh install and configuration of the translation modules with one language, I am unable to schedule different update times for the various translations. Once I schedule an update for the original english version, it is inherited by the translation. If I edit the scheduled update date/time on the translation, it updates the date/time in the original english node.
It does not appear that the scheduler fields on a content type are translatable.
Steps to Reproduce:
- Fresh install of 8.x-2.03
- Enable translation related modules
- Add Spanish Language
- Configure translations for all fields in Content -> Basic Page
- Create new basic page in English
- Save as Draft
- Translate page into Spanish
- Save Draft
- Edit english to schedule update
- Save Draft
- Edit Spanish version
- Schedule update is already populated with English version settings (ISSUE)
- Edit update date/time to something else
- Save Draft
- Edit English version
- Schedule information is now changed to mirror Spanish translation (ISSUE)
Comment | File | Size | Author |
---|---|---|---|
#9 | scheduled_update_translation-2647094-9.patch | 6.52 KB | vbouchet |
|
Comments
Comment #2
gg4 CreditAttribution: gg4 commentedComment #3
gg4 CreditAttribution: gg4 commentedComment #4
vegantriathleteIn one environment in which I run multilingual I am noticing that translated pieces of content (which have scheduled update fields) are not creating a separate entry in the node__ table; everything is recorded against the default site langcode. However, in a different environment I am seeing that there are different langcode entries in the table. I have not checked into the difference in the configuration in the two environments.
In the environment in which it appears to be broken, what I've done is to create a Scheduled Update Type that is targeting a specific bundle for a content entity. I'm using the Embedded Runner and haven't changed the Advanced Runner Options.
I create a piece of content and assign it a date.
Then I translate that piece of content.
I expect to see two different entries in the node__ table; I see only one.
Comment #5
vegantriathleteI'm not sure if this should be considered related to or a duplicate of #2854988: Schedule Moderation State Updates for Translations. I'll mark it as related for the time being.
Since this one is older, I would think it should stay and the other should be marked as a duplicate. I'll mark the other one as related to this one as well.
Comment #6
vegantriathleteI notice that in the Entity definition for scheduled_update it does not use the langcode entity_keys entry nor does it use
$fields = parent::baseFieldDefinition($entity_type);
inside of the baseFieldDefinitions method. Would it be a good step in the right direction to make those changes to the entity? I'm suggesting that we let ContentEntityBase take care of id, uuid and langcode.Comment #7
balsamaWe dug into this over in #2854988: Schedule Moderation State Updates for Translations (which I closed as a duplicate). Here is what we found - some if it specific to Lightning's implementation:
Scheduled Updates
And the from the configuration (Lightning) side:
Configuration (Lightning)
There are two types of Updates:
For the former, the update field would need to be translatable. Lightning couldn't ship with a translatable field since it doesn't have Content Translation enabled out of the box. But it should be (?) fairly intuitive to the user once the translation->false is removed from Scheduled Updates (would be just like any other field)
For the latter, the update itself would either need to be translated (likely) or the reference to the entity would need to reference a specific language (which I don't think is currently possible).
Entity Reference
It looks like Entity Reference doesn't currently support referencing a specific language. That should be fine, but it causes some weirdness when trying to reference something that is translated. E.g. autocomplete works when typing reference in Language A, but Language B shows up as option.
Considerations
What about users who want to schedule a transition to all languages at once? The update runner would likely need to take that into account (that is, if an untranslated update references a translated entity that == update all languages)
Summary
This is a fair amount of work. There is no current workaround for users who need this functionality and I'm honestly a little surprised that it hasn't come up before. But that fact that it hasn't makes me wonder how much of our limited resources we should throw at it.
Comment #8
vegantriathleteCopy issue summary from 2854988
Comment #9
vbouchetHi,
I initially started to work on https://www.drupal.org/node/2854988 about 3 months ago. As always, I thought I would have time to dive more in the issue but it never happened so I think it is better to take time to share my findings and my work.
First, I added the translation support to the scheduled update entity type.
Then I edited the getEmbeddedUpdates() method to properly store the scheduled update language in the queue item. Previously, it was only storing the entity_id which makes impossible in the queue worker to update the appropriate translation of the given entity.
Finally, I tried to update the BaseUpdateRunner::runUpdate() method to use the language stored in the queue item.
This is where I am stucked. Given a translated entity with a different schedule update for each translation, the proper information are stored in the queue. However, the queue worker is not properly dealing with the data and only one of translation's update is performed, the second one remain in the queue.
Please find a patch with this work. Hope I went in the good direction and it will help solving the issue.
Comment #10
FlutterStack CreditAttribution: FlutterStack commentedI tried #9 but scheduled update is not listing in content translation page.
I reverted the patch and added
scheduled update listed and content translation enabled successufully.
I made few observation.
1. suppose if we edit german node by default german scheduled update inlined add/edit form should be loaded, but if we have created scheduled update for english content then only german node is showing scheduled update in english, german node supposed to show german scheduled update only.
2. If we try to run scheduled update then below error is occured. Basically we need to change all the queries to get entity and revisions with respect to languauge.
The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\Query\QueryException: 'update_timestamp' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 316 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
Drupal\Core\Entity\Query\Sql\Tables->addField('update_timestamp', 'INNER', NULL) (Line: 44)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 155)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 74)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 580)
Drupal\scheduled_updates\Plugin\BaseUpdateRunner->getReadyUpdateIds() (Line: 46)
Drupal\scheduled_updates\Plugin\UpdateRunner\LatestRevisionUpdateRunner->getEntityIdsReferencingReadyUpdates() (Line: 37)
Drupal\scheduled_updates\Plugin\UpdateRunner\EmbeddedUpdateRunner->getEmbeddedUpdates() (Line: 79)
Drupal\scheduled_updates\Plugin\UpdateRunner\EmbeddedUpdateRunner->getAllUpdates() (Line: 125)
Drupal\scheduled_updates\Plugin\BaseUpdateRunner->addUpdatesToQueue() (Line: 131)
Drupal\scheduled_updates\UpdateRunnerUtils->runAllUpdates() (Line: 65)
Drupal\scheduled_updates\Form\UpdateRunnerForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('update_runner_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('update_runner_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment #11
ejanus CreditAttribution: ejanus as a volunteer commentedHi All,
I see this issue is now 2 years running. However, I don't see any updates. I'm sure many enterprises using Drupal require this. This is a serious ask from our content editors. Any info on if this is going to be fixed or work-arounds would be very appreciated. =)