Jump to content

Language alternate field with value 0 not respected


charger
 Share

Recommended Posts

I have the two integer fields called price and price_de. When I request the value of price with language de, it only provides the correct value if price_de is any other than empty or greater than 0. While I would expect an empty field to fall back to the value of the default language, having a value 0 should actually return 0. I set the option Blank and 0 have different meanings in both fields. I’m currently running PW 3.0.165.

Anyone else experiencing this?

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

So the culprit is here: https://github.com/processwire/processwire/blob/master/wire/modules/LanguageSupport/LanguageSupportFields.module#L159

Using empty() to check for a value in the field will return true if that value is 0. I changed it to !isset() and now it is working as expected.

Posted here: https://github.com/processwire/processwire-issues/issues/1431

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...