Problem/Motivation
Upgrading from 8.1.0 to 8.3.0 makes field group an unusable module. There are several issues in this current version and can only find the following error when attempting to use it:
Notice: Undefined index: name in Drupal\field_ui\Element\FieldUiTable::reduceOrder() (line 228 of /var/www/html/docroot/core/modules/field_ui/src/Element/FieldUiTable.php)
The issues are as follows:
1.) When trying to create a new tab and moving it under tabs directly it just disables it. To get around this you can move the tab out of disable, save it, and then move it under the tabs.
2.) Some fields absolutely refuse to be under a tab while others work perfectly fine. There is no rhyme or reason to this but it just appears that something about the field that field_group does not like and just refuses. I have tried moving from one tab to another, disabling that field, using different type of tab, renaming the tab, uninstalling the module completely, downgrading to the dev version, changing widgets and essentially everything you can do from the front end.
In its current state this module simply doesn't work as intended and the 8.1.0 is no longer supported. This may work for some if the fields somehow do not end up on the "naughty" list of fields that do not seem to work but in my case out of around 20 fields I had 5 that fell into this category.
Proposed resolution
Fix the notice.
Remaining tasks
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | interdiff_29-30.txt | 565 bytes | danflanagan8 |
| #30 | 3064890-30.patch | 2.74 KB | danflanagan8 |
| #29 | 3064890-29-FAIL.patch | 2.19 KB | danflanagan8 |
| #22 | undefinedindex-3064890-22.patch | 565 bytes | peonboyos |
| #18 | field_group-undefined-index-name-3064890-18.patch | 701 bytes | mottihoresh |
Comments
Comment #2
rgristroph commentedI am working on a project that also has this issue.
Comment #3
wturrell commentedWorkaround (1) is very useful, thanks. I'm yet to experience (2), fields that won't stay under a tab, but it's early days.
Comment #4
mpp commentedAdded patch from https://www.drupal.org/project/field_group/issues/2968184#16
Update: this doesn't fix the issue for us
Comment #6
webczarina commentedI have gotten a similar error since upgrading from 8.1.0 to 8.3.0:
Notice: Undefined index: group in Drupal\Core\Render\Element\VerticalTabs::preRenderVerticalTabs() (line 82 of /usr/local/docroot/site/mysite-dev.edu/web/core/lib/Drupal/Core/Render/Element/VerticalTabs.php)
This occurs when users attempt to edit a node where I've set up a field group using vertical tabs.
Comment #7
timcosgrove commentedJust chiming in that we also saw this when trying to update from 1.0 to 3.0-rc1. The Paragraphs patch listed as required does not affect the error and appears unrelated.
Comment #8
mpp commented@timcosgrove, the paragraphs issue is related in a sense that it reproduces the error mentioned in this issue. The patch in that issue is indeed unrelated ;-)
Comment #9
mpp commentedComment #10
mpp commentedComment #11
mpp commentedComment #12
mpp commentedComment #13
tbenice commentedIm totally unable to move a new field group out of disabled. Doesn't matter what I do. This is on a node form display.
Comment #14
swentel commentedThere are a bunch of issues indeed with drag / drop and notices. I can also reproduce the tabs thing, it's super annoying .. :)
Going to fix them in #3075264: Fix upgrade path to account for DS regions
Also opened #3085858: Drag and drop acts weird, sometimes not resetting the parent, or even clearing the region value
Comment #15
scott_euser commentedI have been trying to follow the various related issues, but none seem to solve.
Ie, I still get
Undefined index: name in Drupal\field_ui\Element\FieldUiTable::reduceOrder(). Steps to reproduce:Example array passed to reduceOrder
So only key available is
childrenwhile a keynameis expected.Should I post a new issue?
Comment #16
scott_euser commentedWell for now will just leave this patch here, happy to move to a new issue, but definitely still reproducible as per above. This patch just provides extra '#name' attributes for the tabs and tab FieldGroupFormatters so that core field_ui module is able to handle sorting. Not a long term fix; just avoids the notice.
Comment #17
mottihoresh commentedSeems like it's a problem with all of the filed group formatters, Attached is a patch for the HTML Element.
Comment #18
mottihoresh commentedComment #19
duneblD9.1.5 and field_group 3.x-dev
I am using details and I have added the
'#name'key everywhere inDetails.phpas per #16 and #17 without luck.Here is the core function producing the error:
My feeling is that
if ($a['name']) {..}should beif ($name=$a['name']??FALSE){$array[]=$name;}or like this. This is because I can't think of a case where$a['name']is set and not TRUECould it be a core bug?
I my case the
'name'key was not set (only$a['children'])Comment #20
coaston commentedany update?
Comment #21
khaled_webdev commentedI bypassed by replacing
if ($a['name']) {by
if (!empty($a['name'])) {I used this fix to hide error, i continued on editing and after saving, i restored
Comment #22
peonboyos commentedIve match the patch for this comment. #21
Comment #23
eahonet commented@peonboyos I used your patch in #22. Took me a second to realize to apply it to core and not field_group. It did get rid of the error. The site seems to functioning well so far with this core change.
Comment #24
ralkeon commentedSeems that this issue is still present, it's not a duplicate and the #22 patch it's working for me. I hope I edited the issue metadata correctly. Re-opening the issue.
Comment #25
quotientix commented+1 and thanks for the patch - works for me!
Comment #26
joshmillerProblem experienced for me on 9.2.7 as well, while creating a new field_group. Patch applied to Drupal core without fuss. Error went away.
Comment #27
kristen polThanks for the patch!
I tested with and without the patch (see screenshots). Code change is very simple and makes sense. Marking RTBC.
Comment #28
catchThis could use some test coverage.
Comment #29
danflanagan8I took a crack at writing a unit test for this. It's pretty straightforward. No mocking or anything.
The third case is going to trigger a failure. I tried to make a "realistic" case by following #19:
Changing version to 9.4.x too.
Comment #30
danflanagan8The test failed at the right place with the right message so I'm removing the Needs tests tag.
Here's a patch that includes the fix from #22.
Comment #31
volker23 commentedApplied patch from #30 without hassle on 9.2.10, error gone, seems to work as expected. Thanks!
Comment #32
heykarthikwithu+1 patch #30, thanks for the patch.. works.
Comment #33
delacosta456 commentedhi #30 looks to be ok for me too on
D8.9.20 thanks
Comment #34
joegl commentedPatch in #30 applied cleanly to our Drupal 9.2.9 site and resolved the warning/issue.
Comment #35
joegl commentedI believe the below has to do with our composer patch setup and not the patch itself. Please ignore below.
For anyone who does run into the issue I was having below see:
- https://github.com/cweagans/composer-patches/tree/1.x#allowing-to-force-...
- https://github.com/cweagans/composer-patches/issues/43
Scratch that. We applied the patch with the composer and the test file was placed in its own directory instead of being added to the field_ui module.
Instead of adding the new test file to:
core/modules/field_ui/tests/...It created the following path and file :
core/b/core/modules/field_ui/tests/...The change to the FieldUiTable.php file was applied cleanly in the correct directory.
Comment #36
joshmillerTests failed and passed as expected. Patch applies. Previous to tests was RTBC. Back to RTBC.
Comment #38
catchCommitted/pushed to 10.0.x, cherry-picked to 9.4.x and 9.3.x,thanks!