-
-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.x] Allow entries to be drafted without requiring validation #8919
[4.x] Allow entries to be drafted without requiring validation #8919
Conversation
Love this, the validation on unpublished drives us crazy sometimes. |
Thank you for this PR. I absolutely agree that there should be a way to save incomplete data. However I'm not sure that completely bypassing validation is the right move. I think what may be a more suitable solution is to have a way to define rules that should only be applied when publishing. I've two solutions that come to mind:
The second option is probably more feasible as we wouldn't need to pass two arrays all over the place. Also having this "publish only" option for non-entry blueprints becomes weird. |
@jasonvarga why do you say that? When our clients start new entries they rarely want any validation at all, they only need to start getting data in, regardless of its correctness. |
We still need some data integrity. When you save an entry, even a draft, stuff happens like fieldtype processing, events etc. The data should still be in the expected format. Fieldtypes may provide their own validation rules for this. If you were using a traditional DB and you didn't have validation, you might end up putting invalid types into a column and you'd get query errors. There could also be the possibility of a security issue. (I don't know what yet, but I don't want to open it up as a possibility.) I'd wager that most of the time, in a draft you only really care about leaving out required fields. You don't want to bypass all the validation rules.
Stupid example but an |
Agreed, and that might be the best implementation actually, if |
That's not how I don't think just tweaking the required rule logic will work either though, because you could have some other rules that you might not care about in a draft, like |
OK, I'm back to "please remove all rules when in draft". I'd rather start there (cuz that's the easiest), then put things back if folks need them |
Respectfully, no. #8919 (comment) If you really want, you can try this in the mean time: Use the container to rebind the controller. In your |
Somehow I missed this being closed and all this conversation, sorry for delayed replies. I do think a good first step would be to allow Would you be open to a new PR with that approach? |
@ryanmitchell
|
This PR adds a new opt-in collection configuration option
draft_without_validation
which allows unpublished entries to be created without applying any validation rules.Validation rules continue to be applied when the entry is published, but while its in an unpublished state they will not be run.
This can be useful if you are populating content but haven't yet been supplied all the information, or you haven't yet received assets.
I've left this PR as a draft just to get your thoughts, if it's a direction you like I will work on test coverage.
There seems to be a similar idea here: statamic/ideas#765