Problem/Motivation
Warning: Undefined array key "call" in Drupal\conditional_fields\Plugin\conditional_fields\handler\OptionsButtons->checkBoxesHandler() (line 188 of modules/contrib/conditional_fields/src/Plugin/conditional_fields/handler/OptionsButtons.php).
Drupal\conditional_fields\Plugin\conditional_fields\handler\OptionsButtons->checkBoxesHandler(Array, NULL, Array) (Line: 23)
Drupal\conditional_fields\Plugin\conditional_fields\handler\OptionsButtons->statesHandler(Array, NULL, Array) (Line: 263)
Drupal\conditional_fields\ConditionalFieldsFormHelper->getState('field_contact_type', Array, Array) (Line: 163)
Drupal\conditional_fields\ConditionalFieldsFormHelper->processDependeeFields(Array, Array, Array, Array) (Line: 111)
Drupal\conditional_fields\ConditionalFieldsFormHelper->processDependentFields() (Line: 85)
Drupal\conditional_fields\ConditionalFieldsFormHelper->afterBuild(Array, Object) (Line: 405)
conditional_fields_form_after_build(Array, Object)
call_user_func_array('conditional_fields_form_after_build', Array) (Line: 1079)
Drupal\Core\Form\FormBuilder->doBuildForm('node_rfq_edit_form', Array, Object) (Line: 575)
Drupal\Core\Form\FormBuilder->processForm('node_rfq_edit_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 578)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
And next same error for whatsapp array key.
Steps to reproduce
- Create
List (text)fieldfield_contact_typewith valuescall
whatsappandmail. Cardinality unlimited. Change the form display toCheck boxes/radio buttons - Create
Telephone numberfieldfield_phone. - Create dependency:
Target field:field_phone.
Controlled by:field_contact_type.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | interdiff_2-3.txt | 664 bytes | marcos_lima |
| #3 | 3244630-3.patch | 735 bytes | marcos_lima |
| #2 | 3244630-2.patch | 657 bytes | hmendes |
| screenshot.png | 231.32 KB | super_romeo |
Comments
Comment #2
hmendes commentedAdding a patch to fix this problem.
Comment #3
marcos_lima commentedThank you for the patch @hmendes! I reviewed it, going through the following steps:
1) Reproduced the warning
2) Applied the patch
3) Replicated the steps to reproduce.
The problem was still present. Then I did a code review of the changes, and I think that’s because the added IF statement was never true.
So I changed it to reflect the case in question (List (text) with checkboxes) and then it worked and the warning stopped appearing.
Attached is the patch with this change and the interdiff from the previous patch.
Comment #4
hmendes commentedThank @marcos_lima for fixing the patch,
I tested here and it worked when i follow the steps in the IS, but the problem is still happening when the field is a Taxonomy (also with unlimited cardinality and as checkboxes ).
The patch provided fixes the issue when the field is a list(text) cause it was trying to get the first checkbox, instead of all checkboxes, when I tested with the Taxonomy field, the problem is that the key of the checkbox is not the same of its value. IMO we should create another issue to fix the problem with Taxonomy field, and move this one to RTBC.
Comment #6
colanThanks!