Skip to content

8.3: Default value not set/used when using 0 as default value

When setting the default value of a field to 0, for example for a number field in the quote module it has two problems:

  1. In the layout editor it still shows "Default value not set", allthough it's set when editing the field and also in the database.
  2. When creating an entity it will not fill out the field with the default value.

The problems are mostly around if statements in the format of if($defaultValue) or if(!empty($defaultValue)) which both return false in PHP when passing a 0. I'm not sure this is intended behaviour so the checks were changed to if(isset($defaultValue) && $defaultValue !== '').

I fixed it and will push a commit and create a merge request.

Edited by Jürgen Faßmann