I am trying to set up sending an email to all the users of a specific role. I clicked on "Add email," selected the role, CC to current user email address, turned off most of the included values, [Advanced] additional settings for on Completed. Then I clicked Save.
TypeError: Argument 1 passed to Drupal\Core\Form\OptGroup::flattenOptions() must be of the type array, string given, called in C:\ExceedDrupal_1\web\modules\contrib\webform\src\WebformSubmissionGenerate.php on line 196 in Drupal\Core\Form\OptGroup::flattenOptions() (line 23 of C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Form\OptGroup.php) #0 C:\ExceedDrupal_1\web\modules\contrib\webform\src\WebformSubmissionGenerate.php(196): Drupal\Core\Form\OptGroup::flattenOptions('compliance') #1 C:\ExceedDrupal_1\web\modules\contrib\webform\src\WebformSubmissionGenerate.php(108): Drupal\webform\WebformSubmissionGenerate->getTestValues(Object(Drupal\webform\Entity\Webform), 'personal_data_s...', Array, Array) #2 C:\ExceedDrupal_1\web\modules\contrib\webform\src\Plugin\WebformElement\WebformCompositeBase.php(807): Drupal\webform\WebformSubmissionGenerate->getTestValue(Object(Drupal\webform\Entity\Webform), 'personal_data_s...', Array, Array) #3 C:\ExceedDrupal_1\web\modules\contrib\webform\src\Plugin\WebformElementManager.php(234): Drupal\webform\Plugin\WebformElement\WebformCompositeBase->getTestValues(Array, Object(Drupal\webform\Entity\Webform), Array) #4 C:\ExceedDrupal_1\web\modules\contrib\webform\src\WebformSubmissionGenerate.php(186): Drupal\webform\Plugin\WebformElementManager->invokeMethod('getTestValues', Array, Object(Drupal\webform\Entity\Webform), Array) #5 C:\ExceedDrupal_1\web\modules\contrib\webform\src\WebformSubmissionGenerate.php(108): Drupal\webform\WebformSubmissionGenerate->getTestValues(Object(Drupal\webform\Entity\Webform), 'staff_file_requ...', Array, Array) #6 C:\ExceedDrupal_1\web\modules\contrib\webform\src\WebformSubmissionGenerate.php(80): Drupal\webform\WebformSubmissionGenerate->getTestValue(Object(Drupal\webform\Entity\Webform), 'staff_file_requ...', Array) #7 C:\ExceedDrupal_1\web\modules\contrib\webform\src\Element\WebformCodeMirror.php(307): Drupal\webform\WebformSubmissionGenerate->getData(Object(Drupal\webform\Entity\Webform)) #8 C:\ExceedDrupal_1\web\modules\contrib\webform\src\Element\WebformCodeMirror.php(190): Drupal\webform\Element\WebformCodeMirror::validateTwig(Array, Object(Drupal\Core\Form\FormState), Array) #9 C:\ExceedDrupal_1\web\modules\contrib\webform\src\Element\WebformCodeMirror.php(146): Drupal\webform\Element\WebformCodeMirror::getErrors(Array, Object(Drupal\Core\Form\FormState), Array) #10 [internal function]: Drupal\webform\Element\WebformCodeMirror::validateWebformCodeMirror(Array, Object(Drupal\Core\Form\FormState), Array) #11 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Form\FormValidator.php(282): call_user_func_array(Array, Array) #12 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Form\FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #13 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Form\FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #14 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Form\FormValidator.php(238): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #15 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Form\FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'webform_handler...') #16 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Form\FormBuilder.php(576): Drupal\Core\Form\FormValidator->validateForm('webform_handler...', Array, Object(Drupal\Core\Form\FormState)) #17 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Form\FormBuilder.php(319): Drupal\Core\Form\FormBuilder->processForm('webform_handler...', Array, Object(Drupal\Core\Form\FormState)) #18 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Controller\FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\webform\Form\WebformHandlerAddForm), Object(Drupal\Core\Form\FormState)) #19 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #20 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #21 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\Render\Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #22 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #23 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #24 C:\ExceedDrupal_1\vendor\symfony\http-kernel\HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #25 C:\ExceedDrupal_1\vendor\symfony\http-kernel\HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #26 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\StackMiddleware\Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 C:\ExceedDrupal_1\web\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 C:\ExceedDrupal_1\web\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 C:\ExceedDrupal_1\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 C:\ExceedDrupal_1\web\core\lib\Drupal\Core\DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 C:\ExceedDrupal_1\web\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #35 {main}.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3112015-6.patch | 1.1 KB | jrockowitz |
| #4 | test_form.yml | 25.23 KB | nancydru |
Comments
Comment #2
jrockowitz commentedI am not sure how to reproduce this issue.
Please provide me with a simple example webform that I can use to reproduce this issue.
If you have an existing webform, you need to simplify it to only include the elements and settings which are needed to trigger the error.
My guess is a select menu with reusable options or custom code is triggering this issue. The error is definitely related to the
#optionsproperty being a string.Comment #3
nancydruHaving trouble shrinking the form, so I'm taking out one page at a time. At least that way I can isolate the problem.
Comment #4
nancydruOkay, I think I have isolated it to the two custom composite pages (Staff File Requirements, Child File Requirements). If I remove both of them I am okay. With either, it fails.
Comment #5
nancydruIf you need the customized radio options, let me know.
Here's what I did:
.
Comment #6
jrockowitz commentedThe table element nested in a custom composite is not a supported behavior and this is triggering the error. The attached patch prevents the fatal error but does not add support for table elements nested in a custom composite.
My recommendation is to build a composite element via code, which will be more stable and customizable.
Comment #7
nancydruThanks. I will have to look at that because my boss is rather insistent on having this.
Comment #8
nancydruIndeed the TypeError message is gone. Thanks.
When I completed the submission, I did get Notice: Undefined index: #webform_id in Drupal\webform\Plugin\WebformElement\ContainerBase->formatHtmlItem() (line 169 of modules\contrib\webform\src\Plugin\WebformElement\ContainerBase.php).. My test site seems to be unable to actually send email, so that may be the problem.
Comment #9
nancydruWhen I reload the submission (which used "Test"), I receive a bunch of these:
Comment #10
jrockowitz commentedYou are using unsupported nested elements in the composite's #elements markup. I am not sure I can keep providing patches to work around this issue.
Comment #11
nancydruI am replacing the table with just regular radios. The table wasn't really necessary.
Comment #12
nancydruWhen you said "table" were you referring to "'#type': details", which would mean that one cannot include details within custom composite?
The customer really wants collapsible areas. Details is the only one I see that does that.
Comment #13
jrockowitz commentedYes, the details in the custom composite is not supported in the UI.
Comment #14
nancydruActually, it appears that the UI does not support any type of container in a custom composite. Will using a simple "container" break things too?
Comment #15
jrockowitz commentedHere is a "legitimate hack". Instead of nesting the elements in a details element, the below code wraps the elements in details markup.
Comment #16
nancydruThanks. I will give that a try.
Comment #17
nancydruPerfect! I hadn't done the prefix/suffix trick since D6.
Comment #18
jrockowitz commented