Problem/Motivation
After upgrading to version 8.x-3.3, the following error started to occurs on all Node Edit pages:
TypeError: Argument 1 passed to Drupal\field_group\FormatterHelper::groupElementsContainErrors() must be of the type array, null
given, called in /code/web/modules/contrib/field_group/src/FormatterHelper.php on line 144 in Drupal\field_group\FormatterHelper::groupElementsContainErrors() (line 165 of modules/contrib/field_group/src/FormatterHelper.php).
Steps to reproduce
I upgraded the Field Group module from version 8.x-3.2 to version 8.x-3.3, and the error started to occur. Here is the full stack trace:
TypeError: Argument 1 passed to Drupal\field_group\FormatterHelper::groupElementsContainErrors() must be of the type array, null given, called in /code/web/modules/contrib/field_group/src/FormatterHelper.php on line 144 in Drupal\field_group\FormatterHelper::groupElementsContainErrors() (line 165 of modules/contrib/field_group/src/FormatterHelper.php).
Drupal\field_group\FormatterHelper::groupElementsContainErrors(NULL) (Line: 144)
Drupal\field_group\FormatterHelper::formGroupPreRender(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 772)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 363)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 43)
__TwigTemplate_76a9d0c7eafb622905b6dee254864aea6f4dd9a7cc8ca83f33af736e0b40d8ae->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('core/themes/seven/templates/node-edit-form.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('node_edit_form', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 164)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
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: 57)
Drupal\advban\AdvbanMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
I am using Drupal core version 9.4.6.
Comments
Comment #2
swentel commentedHmm, could check which version of paragraphs you're running, it should be at least 8.x-1.12.
Or if another module calls 'field_group_form_pre_render', then that module should be updated.
Comment #3
mvnovick commentedI am running the latest version of the Paragraphs module, which is currently 8.x-1.15. How can I find out which other module calls 'field_group_form_pre_render'?
Comment #4
swentel commentedHi, to find out if that function is called, you should search the codebase to look for this string: 'field_group_form_pre_render'.
Every editor normally has a search function that can search in all files.
Comment #5
smustgrave commentedThis was marked as a top priority for a D10 release.
On Drupal core 9.4.8
Paragraphs 8.x-1.15
Field Group 8.x-3.3
Setup multiple groups inside my paragraph bundles.
Placed those bundles on a content type
Cannot trigger the error.
Closing as cannot reproduce
If still experiencing the issue please provide steps to reproduce (fields used, group settings, etc)
Thanks!
Comment #6
sandeep date commentedissue is resolved for me by applying patch as below, I am trying to access user profile with custom user display with field group functionality in which some fields are disable, so appeared issue...
Comment #8
sandeep date commentedComment #9
swentel commented@mvnovick : I completely got confused with another issue, the paragraph question was completely wrong, sorry about that :/
@Sandeep Date: do you programmatically disable them, or through the UI? If so, that patch probably can't hurt, I guess.
Comment #13
swentel commentedPatch combining #3293279: Disabled field group gives error. This should also protect against #3032426: Error: Unsupported operand types.
Comment #15
swentel commentedComment #16
swentel commentedComment #17
swentel commentedHmm, double checking if the revert turns it green (or whether there are some testbot problems)
Comment #18
swentel commentedprobably temporarily testbot thing (crossing fingers)
Comment #19
swentel commented