Skip to content

Commit 7998ada

Browse files
committed
allow the value zero as input for number elements
1 parent e6071cd commit 7998ada

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

elements/number.php

+18
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,24 @@ protected function typeCastValue()
214214
$this->value = (float) $numberString;
215215
}
216216
// }}}
217+
218+
// {{{ isEmpty()
219+
/**
220+
* @brief custom empty check
221+
*
222+
* Number specific empty check (allows for zero int/float values)
223+
*
224+
* @return bool empty-check result
225+
**/
226+
public function isEmpty() {
227+
return (
228+
empty($this->value)
229+
&& $this->value !== 0
230+
&& $this->value !== .0
231+
);
232+
}
233+
// }}}
234+
217235
}
218236

219237
/* vim:set ft=php sw=4 sts=4 fdm=marker et : */

0 commit comments

Comments
 (0)