Problem/Motivation

If the field value is a falsey/empty value like FALSE or [], then the default value is never used.

Steps to reproduce

Added test cases to showcase the behaviour.

Proposed resolution

Add checks for if the value is: not empty, and is numeric.

That way 0 is not accidentally picked up as empty.

Remaining tasks

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

codebymikey created an issue. See original summary.

codebymikey’s picture

Status: Active » Needs review
joaopauloc.dev’s picture

Status: Needs review » Closed (cannot reproduce)

I couldn't reproduce it, it probably was fixed in the new release.

codebymikey’s picture

Title: Support "0" values without needing to specify a default value. » Ensure the default value is used whenever the field value is truly empty
Priority: Normal » Minor
Issue summary: View changes
Status: Closed (cannot reproduce) » Needs review

Yeah, it appears this was fixed in a later release. Just added the the previous test case for completeness-sake.

If the field value is an empty value like FALSE or [], then the default is not currently used.
So updating the issue to support that instead, whilst also adding test cases for 0.

joaopauloc.dev’s picture

Seems good to me, I'll have a look this weekend.
Thanks.

joaopauloc.dev’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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