Skip to content
Snippets Groups Projects
Commit cb86ab4f authored by Joseph Olstad's avatar Joseph Olstad
Browse files

Issue #3427207 by ramil g, abhishek_gupta1, joelpittet, Vivek Panicker:...

Issue #3427207 by ramil g, abhishek_gupta1, joelpittet, Vivek Panicker: TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count()
parent adc3234e
No related branches found
No related tags found
No related merge requests found
......@@ -341,11 +341,12 @@ class OptionsShsWidget extends OptionsSelectWidget implements ContainerFactoryPl
if (!is_array($value)) {
$value = [$value];
}
if ($element['#shs']['settings']['anyValue'] === reset($value)) {
$first_value = reset($value);
if ($element['#shs']['settings']['anyValue'] === $first_value || empty($first_value)) {
if (!$element['#required']) {
return;
}
elseif (count($element['#options']) > 1) {
elseif (!isset($element['#options']) || count($element['#options']) > 1) {
$form_state->setError($element, t('You need to select a term from the deepest level in field @name.', ['@name' => $element['#title']]));
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment