Needs review
Project:
Save Draft
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Mar 2014 at 21:05 UTC
Updated:
31 Aug 2021 at 19:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rooby commentedYes, patches are welcome.
No work has been done on this yet.
If you submit a patch for the drupal 7 version to this issue that would be the best way forward.
Then once it has had some review and is in a decent state an 8.x branch can be created in the repository.
Comment #2
anavarreDrupal 8 introduces the concept of Save as unpublished for a piece of content. I *think* this might remove the need for Save Draft completely.
Comment #3
kingfisher64 commentedSounds like this will be unnecessary in 8 then.
Thanks Drupal another UI improvement. :)
Comment #4
pravin ajaaz commentedAs this is in drupal 8 core UI, Closing the issue.
Comment #5
unsettlingtrendHow is this any different than what you could do in Drupal 7 core without this module? You could always save as unpublished.
In particular, I'm looking for the D7 version of this to allow the draft's to be saved without required fields being filled in/before being published.
It feels like this is less "in D8 core" and more "no D8 version planned."
Comment #6
rooby commentedIt might be worth having more discussion then.
The saving incomplete required fields is one of the main use cases of this module.
Since Drupal core already has the draft button though, I wonder if this should happen here or in another module with a name along the lines of "Save incomplete" or something.
On the other hand, if the functionality and code is going to be similar it might be best to just keep it in this module.
Or maybe it should be as a patch for D8 core.
A very brief search hasn't shown anything out there currently so I might look at how easily this will port over to D8 in the next few days.
Maybe the best course of action would be a D8 version of this module, then a patch for D8. Then we can just mark this one as deprecated if the patch ever gets into core.
Comment #7
rooby commentedAnother very quick glance at the D8 code shows that we should have the relevant pieces to use a similar solution that the D7 version of this module uses.
Comment #8
unsettlingtrendI apologize if I'm missing something (but I also like to think/hope/use as a scapegoat anyone else in my position that reaches the thread later), but where is this "draft" button you mention? Do you just mean the "save as unpublished"? Or is it something/a module that's enabled?
I agree with everything else you say though. I feel that it might not be so easy/clearcut to agree on the behavior though, and how it should fit with the content moderation and workflows modules though.
Comment #9
rooby commentedYeah, I was referring to the save as unpublished feature, which is essentially a draft by a different name.
For a D8 version of this module I would expect it work similarly to the D7 version. - Rename buttons and add required validation skipping.
How it fits in with moderation modules would need further consideration.
Comment #10
attheshow commentedHere's a first pass at a D8 version/port. I'm attaching both a patch against the 7.x-1.x branch and a zip file version.
Comment #11
rooby commentedThat's great, thanks.
I'll review it ASAP. I definitely won't get to it today but I should be able to look at it in the next couple of days.
Comment #12
asherry commentedJust re-rolling Mark's patch, I think he didn't include some new files that he wrote plus I'm adding one modification that the new submit handler for the 'draft' button will inherit the submit handlers for the existing submit button.
Otherwise it doesn't save the values in the form.
Comment #13
asherry commentedI created a sandbox with our work for easy reference
https://cgit.drupalcode.org/sandbox-asherry-2992675
Comment #14
asherry commentedadded a fix for the submit handlers that was accidentally unpublishing and publishing nodes
Comment #15
asherry commentedSorry one more fix for the labels being mixed up
Comment #16
asherry commentedComment #17
bgreco commentedAs of Drupal 8.4, the "Save as unpublished" button is no longer part of core. I applied patch #15 and it works great. Any chance of it being turned into an 8.x release?
Comment #18
pieterjandp commentedPatch #15 works, but it seems like #1786442: Allow saving drafts with missing required fields is not included in this patch.
Allowing saving drafts with missing required fields has become more difficult in Drupal 8, because of the added Entity Validation. Any thoughts on how to tackle this problem in a nice way?
I posted an ugly ad hoc solution here. disable_html5_validation is used to disable client side validation, the form is altered with #after_build to prevent the form validation of required fields and #validate is used to remove any NotNull errors related to required fields and to set the entity as validated if no errors remain.
Comment #19
james.williamsFor anyone running into this - https://www.drupal.org/project/require_on_publish appears to be the answer for how to allow saving drafts without values in required fields in Drupal 8/9.
If this module were to at least restore a button, I think the current patch at least needs updating to work with Drupal 9.
Comment #20
attheshow commentedHere's a zip of our D9 version (basically just updates the .info.yml file for D9).