Problem/Motivation
I created an email template and associated it with the default Editorial workflow. I attempted to delete the template and received the warning message that the Editorial workflow was being used and would be deleted if I continued. Then, I removed all associations between the email template and Editorial workflow and tried deleting again. The warning was provided again and, on testing it, the workflow was removed along with the email template.
Steps to reproduce
- Install Drupal with standard profile
- Enable content_moderation and workbench_email modules
- Create an Email Template
- Edit the Editorial workflow
- Edit the Publish transition
- Enable the template created above, hit Save
- Delete the template
Proposed resolution
Rearrange configuration so templates define which transitions they apply to and the workflow has no dependent configuration.
Remaining tasks
Review
User interface changes
Configuration of templates for each transition has moved to the template configuration form.
API changes
Data model changes
Workflows no longer have third party dependencies on workbench_email. Email templates now have dependencies on workflows.
Issue fork workbench_email-3006343
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jlhayes commentedComment #3
larowlanComment #4
larowlanComment #5
rwohlebI've run into this as well with 8.x-1.1 from 2/25/19.
One possibility is that we simply block deletion of a template as long as it is being referenced by a workflow. Leave it to the user to clear up the dependency.
Comment #6
mstrelan commentedAn alternative would be to add transitions to the template rather than adding templates to the transition. I think it makes more sense that way as that way we're not altering existing config and you can safely remove this module without affecting the transitions. Or have a separate config that maps templates and transitions.
Comment #7
karens commentedThis also affects the ability to uninstall this module. If you uninstall the module, all your workflows are deleted.
Comment #8
acbramley commentedI like this idea, I always find it odd having to go to a separate screen to wire the transition -> the email template.
Comment #9
scotwith1tthank god for version control. hopefully this will be fixed soon. deleting the workflow makes no sense. just update the workflow if the email template is deleted to remove that enforced dependency.
Comment #10
larowlanLet's go with #6
Comment #11
mstrelan commentedComment #13
mstrelan commentedHere's a really rough start.
Working:
Not working:
Comment #14
aitala commentedPlease note that I have also not been able to disable a template for a particular workflow. If I disable it either in the workflow settings or the email template settings, it re-appears...
Eric
Comment #15
mstrelan commentedComment #16
mstrelan commentedComment #17
mstrelan commentedI guess we need an update hook for existing config
Comment #18
mstrelan commentedComment #19
larowlanLooks great, left a code review
Comment #20
mstrelan commentedComment #21
larowlanI tested this locally on an existing project - the UI works as expected as do the dependencies
We could add an update path test here, but they've been tricky to maintain in the past, as you need to update for each major version of core.
One thing I noticed in the update path, is we didn't end up resolving the forced config dependency
e.g. the workflow still has
So we'll need to update that in the update path too.
Comment #22
mstrelan commentedComment #24
larowlan🎉Fixed, this will go out as 3.0.0