mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 00:53:48 +00:00
improve function isEmptyValue + tests
This commit is contained in:
@@ -269,11 +269,6 @@ class CustomFieldChoice extends AbstractCustomField
|
||||
return true;
|
||||
}
|
||||
|
||||
// if only one choice...
|
||||
if (is_string($value)) {
|
||||
return empty($value);
|
||||
}
|
||||
|
||||
// if multiple choice OR multiple/single choice with other
|
||||
if (is_array($value))
|
||||
{
|
||||
@@ -282,17 +277,14 @@ class CustomFieldChoice extends AbstractCustomField
|
||||
if ($value['_choices'] === NULL) {
|
||||
return true;
|
||||
}
|
||||
if (is_string($value['_choices'])) {
|
||||
return empty($value);
|
||||
}
|
||||
if (is_array($value['_choices'])){
|
||||
return count($value['_choices']) > 0;
|
||||
}
|
||||
return empty($value['_choices']);
|
||||
} else { // we do not have 'allow other'
|
||||
return count($value) > .0;
|
||||
return empty($value);
|
||||
}
|
||||
} else {
|
||||
return empty($value);
|
||||
}
|
||||
|
||||
|
||||
throw \LogicException("This case is not expected.");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user