Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When I enable Field Group, I get the following error on every page:
Notice: Undefined variable: element in field_group_build_entity_groups() (line 299 of modules/contrib/field_group/field_group.module).
field_group_build_entity_groups(Array, 'page', Array) (Line: 293)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 438)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 472)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 88)
__TwigTemplate_dbdef2360c80bd63a5c99f87245c438f4d81dc53d6bcf0b0a8ca910d64c51a56->doDisplay(Array, Array) (Line: 381)
Twig_Template->displayWithErrorHandling(Array, Array) (Line: 355)
Twig_Template->display(Array) (Line: 366)
Twig_Template->render(Array) (Line: 64)
twig_render_template('core/themes/classy/templates/layout/html.html.twig', Array) (Line: 390)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 438)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 152)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 95)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 116)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 86)
Drupal\purge_queuer_url\StackMiddleware\UrlRegistration->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 31)
Drupal\gc_api\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Proposed resolution
Debug the issue and resolve it. :)
Remaining tasks
- Write Patch
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#5 | field_group-element-undefined-2730089-5.patch | 448 bytes | achton |
Comments
Comment #2
davidwbarratt CreditAttribution: davidwbarratt at Golf Channel commentedComment #3
ozinHi @davidwbarratt, could you provide more details? I've installed dev version of this module but did not see those errors.
Drupal version: 8.1.1
Module version: 8.x-1.x-dev
Comment #4
ahebrank CreditAttribution: ahebrank at NewCity commentedIt's possible for $element to be returned here before it's initialized in field_group_build_entity_groups() if none of the conditionals are met:
I added
at the top of the function to mitigate the PHP error, but haven't investigated what this might break.
EDIT: I'm getting this in the stable version--haven't tried dev but the code in vcs looks like it's the same.
Comment #5
achtonI ran into this problem as well.
We have entity templates enabled for
block_content
, and when they pass throughfield_group_build_entity_groups()
, they have no 'elements' and no 'content', thus the return statement fails.Comment #7
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedThx for the patch. I committed it to dev.