Checks if a field value is empty.
$value: The field value.
bool $empty_zero: Whether or not this field is configured to consider 0 as empty.
bool $no_skip_empty: Whether or not to use empty() to check the value.
bool TRUE if the value is considered empty, FALSE otherwise.
function is_value_empty($value, $empty_zero, $no_skip_empty = TRUE) {
if (!isset($value)) {
$empty = TRUE;
}
else {
$empty = $empty_zero || $value !== 0 && $value !== '0';
}
if ($no_skip_empty) {
$empty = empty($value) && $empty;
}
return $empty;
}