- Issue created by @dieterholvoet
- Merge request !15Add option to generate PDFs in background using a queue → (Merged) created by dieterholvoet
- 🇬🇧United Kingdom scott_euser
Thanks I can see this being a really useful feature for some sites, thanks for your contributions. I added a couple comments.
- 🇬🇧United Kingdom scott_euser
Not sure if you have gitlab comments enabled (I think off by default) so just adding that I replied to your reply. Thanks!
- 🇧🇪Belgium dieterholvoet Brussels
Not sure if you have gitlab comments enabled (I think off by default) so just adding that I replied to your reply. Thanks!
I have them enabled, no need to notify me here. Thanks
- 🇬🇧United Kingdom scott_euser
Okay going to see if one of my colleagues can give this a test run in one of our heavier usages of the module next regular maintenance round (which unless there is a security release that affects us, is probably in the new year in fairness, in case someone else wants to review earlier).
Thanks for the work on this!
- 🇧🇪Belgium dieterholvoet Brussels
Sounds good! Did a small change to the documentation you added.
- 🇬🇧United Kingdom andreastkdf
Thanks for the great addition @DieterHolvoet!
Testing this on an existing site using the module
This is after using the patch and running
drush updb
, which runs the hook:
10002 - Set default value for new 'method' option.
- New PDF generation happens options on the content type Edit page. Very minimal,
but maybe the wording needs to be updated here? Maybe something like:
Should the PDF be generated? or PDF generation mode
(and update the option labels from to Manual, ...
and to Automatic, ...). - The "Manually, after clicking the 'Save and generate PDF' button" option is selected by default.
Default behaviour - without any change in the settings - using default
Manually, after clicking the 'Save and generate PDF' button.- ✓ Live PDF preview works.
- ✓ "Save and Generate PDF" button is available on the content item.
- ✓ "Save and Generate PDF" works as usual; generates the PDF and saves it to the configured destination media document field.
New behaviour - using Automatically, when the node is saved.
- ✓ Can we also add this new method on the module page after it's merged?
- ✓ Submit button label is removed on the content type Edit page.
- ✓ Made a small change, saved the node, and ran cron. PDF generation job worked; it generates the PDF and saves it to the configured destination media document field.
-
✗ Issue with translations:
I followed the same steps for a node with multiple translations and noticed that saving translations does not add the job to the queue. This means separate translated PDFs are not being generated, unlike with the manual option.
For example:
- ✗ On a node with multiple translations, I edited a translation, saved it, and then ran cron.
Result: The "translated" PDF was not generated. - ✓ By comparison, using the manual option:
On the same node, I edited a translation and clicked Save and Generate PDF.
Result: The PDF was generated for the current translation and updated the translatable destination media document field.
The behaviour of the automatic option should match the manual option, where saving a translation triggers the generation of the corresponding translated PDF.
- ✗ On a node with multiple translations, I edited a translation, saved it, and then ran cron.
- New PDF generation happens options on the content type Edit page. Very minimal,
- 🇧🇪Belgium dieterholvoet Brussels
New PDF generation happens options on the content type Edit page. Very minimal, but maybe the wording needs to be updated here?
I changed the title, but I don't agree with the proposed changes to the options. 'Automatic, when the node is saved' is not proper English.
I followed the same steps for a node with multiple translations and noticed that saving translations does not add the job to the queue.
I added a hook that triggers when creating a new translation. Are you sure updating a translation doesn't work yet? Because there's no such thing as a translation update hook, normal update hooks should be triggered when updating a translation.
-
scott_euser →
committed c603dc72 on 1.0.x
Issue #3492664 by dieterholvoet: Add option to automatically generate...
-
scott_euser →
committed c603dc72 on 1.0.x
- 🇬🇧United Kingdom scott_euser
Thanks very much!
I did a retest with:
- Automatic enabled
- Saved English and Spanish
- Ran cron
- Both PDFs updated as expected