Problem/Motivation

When making the boolean field as "Require on Publish", the field doesn't throw any validation errors when boolean field is not checked and node is published.

Steps to reproduce

  1. Add a boolean field on any content type.
  2. Check "Require on Publish" checkbox and save.
  3. Now add and publish the node without checking the boolean field.
  4. Observe that the node is getting published without any validation errors.

Proposed resolution

Add a check for boolean fields in RequireOnPublishValidator.php to skip validation only when the boolean field is checked.

Command icon 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

vatsalkhanna created an issue. See original summary.

vatsalkhanna’s picture

Issue summary: View changes
vatsalkhanna’s picture

Status: Active » Needs review
StatusFileSize
new750 bytes

Attached the patch.

markdorison’s picture

Status: Needs review » Needs work

Please re-roll this change in a merge request so that GitLabCI tests will run against it. Thank you!

bakop’s picture

Assigned: vatsalkhanna » bakop
Status: Needs work » Active

bakop’s picture

Assigned: bakop » Unassigned
Status: Active » Needs review

Fix placed in a merge request.
Everything looks good !

divya.sejekan’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new164.88 KB
new144.89 KB
new121.5 KB

Verified with MR! 14 . The issue is fixed , now the Node is not getting published if the boolean field (which has Require on publish set ) is kept unchecked.

Testing Steps :
Add a boolean field on any content type.
Check "Require on Publish" checkbox and save.
Now add and publish the node without checking the boolean field.
Observe that the node is getting published without any validation errors.

Moving to RTBC++

  • markdorison committed d9a22879 on 8.x-1.x authored by bakop
    Issue #3412227 by vatsalkhanna, divya.sejekan: Require on publish not...
markdorison’s picture

Status: Reviewed & tested by the community » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support to this project makes other volunteer contributions more sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triaging issues and adding more context to existing issues.
  • Writing documentation or patches for this project.
  • Writing blog posts or speaking about it at conferences.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.