The following warning happens:
Notice: Undefined index: name in _field_ui_reduce_order() (line 72 of modules/field_ui/field_ui.admin.inc).
I am certain a 3rd party module is involved in my case with the form, but I am not certain which one.
The cause of the warning is that:
<?php
if ($a['name']) {
$array[] = $a['name'];
}
?>
is no the same as:
<?php
if (isset($a['name'])) {
$array[] = $a['name'];
}
?>
This can be found in the file: modules/field_ui/field_ui.admin.inc
on line #72 as mentioned by the warning.
Immediately below the if case on line #72 is:
<?php
if (!empty($a['children'])) {
uasort($a['children'], 'drupal_sort_weight');
$array = array_merge($array, array_reduce($a['children'], '_field_ui_reduce_order'));
}
?>
So, perhaps this is an oversight and they meant to have:
<?php
if (!empty($a['name'])) {
$array[] = $a['name'];
}
?>
Given that this warning might happen as a result of a api mistake by a 3rd-party module, I am asking first for confirmation that the field_ui is or is not supposed to be checking if !empty instead of if variable
Comment | File | Size | Author |
---|---|---|---|
#1 | field_ui_debug-1016144.patch | 910 bytes | yched |
Comments
Comment #1
yched CreditAttribution: yched commentedfield_ui_table_pre_render() internally builds a tree structure of table rows to determine rendering order.
Each entry in the tree structure is supposed to have a 'name', the root of the tree just has an empty name. So the check for
if ($a['name'])
instead ofif (isset($a['name']))
is intentional.I'm not sure what can lead to one entry not having a name. Most probably caused by a contrib module, but figuring out who's at fault and what to fix (core or the contrib module) requires some investigation.
Could you try the attached debug patch and post the resulting output (possibly big, please put that in a txt file) ?
Comment #2
thekevinday CreditAttribution: thekevinday commentedThanks for your time, but with all of the module updates lately the problem stopped appearing at some point.
I am going to assume this problem was with a 3rd party module and was resolved in said module.
I will re-open if I manage to see this bug again and use your patch do debug.
Comment #4
videographics CreditAttribution: videographics commentedI don't know how helpful this will be but I got this after installing Drupal Commerce (Beta-2) and the associated required modules. The error appeared while I was setting up some fields that had been previously defined for other node types.
Comment #5
swentel CreditAttribution: swentel commentedHi Yched, cross referencing to #1176454: Moving fieldsets into another region leaves children behind where you can find steps to reproduce with the field_group module (2 ways). Posting the error message from the patch above. Note, the output comes from the ajax error popup
Comment #6
swentel CreditAttribution: swentel commentedOk closing this, looks like I had a version of Drupal core which didn't work fine - works ok on 7.2 now.
Comment #7
DrupalDan CreditAttribution: DrupalDan commentedNotice: Undefined index: name in _field_ui_reduce_order() (line 81 of /mysite/modules/field_ui/field_ui.admin.inc).
Comment #8
swentel CreditAttribution: swentel commentedWhat's the setup ? In case you're using field group or ds, move it to it's respective queue.
Comment #9
DrupalDan CreditAttribution: DrupalDan commentedHi swentel, I'm using field group.
Comment #10
swentel CreditAttribution: swentel commentedComment #11
jdesrig CreditAttribution: jdesrig commentedI am getting this issue when I try to create a tab group in the Display Suite 'manage display' section. I get the following error:
LOCATION http://localhost:82/ran-bookstore/admin/structure/types/manage/product/d...
REFERRER http://localhost:82/ran-bookstore/admin/modules
MESSAGE Notice: Undefined index: name in _field_ui_reduce_order() (line 81 of C:\EasyPHP-5.3.8.1\www\ran-bookstore\modules\field_ui\field_ui.admin.inc).
I am using:
Drupal 7.18
PHP 5.3.8 VC9
Apache 2.2.21 VC9
MySQL 5.5.16
The group is created (I gave it the name book_info) but it doesn't display any horizontal tabs. What is the issue here?
Comment #12
groovedork CreditAttribution: groovedork commented/* Nevermind.. misunderstood the question */
Comment #13
nils.destoop CreditAttribution: nils.destoop commentedIs this issue still occuring on latest version?
Comment #14
Daniel Wentsch CreditAttribution: Daniel Wentsch commented@zuuperman: yes, I'm still getting this error on 7.x-1.x-dev from 2013-Sep-15
Comment #15
maximpodorov CreditAttribution: maximpodorov commentedI'm getting this problem also in the latest 7.x-1.x-dev when I move "Add new field" line in a previously created group.
Comment #16
ejustice CreditAttribution: ejustice commentedIf you are using field group you might check out comment #18 in this thread. I haven't had a chance to test it myself, but wanted to pass this on before I forgot. https://drupal.org/comment/5835954#comment-5835954
Comment #17
giupenni CreditAttribution: giupenni commentedvery annoying bug, I'm frustrated.
I can't use correctly Field Group and Displya Suite
Comment #18
nils.destoop CreditAttribution: nils.destoop commentedComment #19
maximpodorov CreditAttribution: maximpodorov commentedWhy do you close it without referencing any similar issue?
Comment #20
Luca Cattaneo CreditAttribution: Luca Cattaneo commentedMaybe this can help someone.
I was getting this error, then I discover that the "Add new field" form was not in his original position (I wasn't using it).
It was positioned in a field group. Moving it to the original position, the error disappeared.
Comment #21
katrien_w CreditAttribution: katrien_w commentedIssue solved for me on a custom content type with #20, in my case it was the "Add existing field" that was misplaced in a group. Just pulled it out of the group, at the bottom again, and the notice dissapears. Thanks!
Comment #22
hagit CreditAttribution: hagit commentedThank you Luca Cattaneo(#20)!! Issue solved for me
Comment #23
rzgragg CreditAttribution: rzgragg commentedThanks Luca #20
Comment #24
GarChris CreditAttribution: GarChris commented#20 solved it for me. Thanks Luca!
Comment #25
donquixote CreditAttribution: donquixote as a volunteer commentedExactly.
Reopening.
If someone still thinks this is a duplicate, please link to the respective issue, and add it in "Related issues".
Comment #26
Christian DeLoach CreditAttribution: Christian DeLoach commentedI was getting the same error as well. To troubleshoot the offending field, I temporarily added the following code to _field_ui_reduce_order() in field_ui.admin. This assumes you have the Devel module installed.
I'm using Display Suite and Field Groups. Turns out, the offending field was somehow indented in the Manage Fields UI as if it were a child of a field group. Moving the field left and resaving the display didn't seem to fix the issue. I had to move the field around a few times into other field groups before if finally fixed itself.
Comment #27
mastoll CreditAttribution: mastoll as a volunteer commented@Christian DeLoach, what WAS the offending field? And what does your temporary code do to reveal the offending field?
Unfortunately, unlike #20 or #21, my Add Existing and Add New fields are right where they should be.
Maybe there's another field out of place in my case.
Comment #28
hgoto CreditAttribution: hgoto as a volunteer and at Studio Umi commentedI met the same issue. In my case,
- A field group
group_foo
is enabled and displayed. And it has some fields likefield_a
,field_b
andfield_c
.- And somehow
field_a
gets hidden though it's belongs to the displayed groupgroup_foo
. (I didn't notice when it occurred.)- Then, the field
field_a
is in the hidden group and indented. And the warning message shows up.I don't have any idea how that occurred (I use Features module for the project and it may be related) but I found that moving the field
field_a
to any proper place fixed the issue. I hope this helps.Comment #29
Christian DeLoach CreditAttribution: Christian DeLoach commented@mastoll, sorry for the delayed response. What I meant by "offending field" is that one of the CCK fields triggered the error depending upon the field's placement. Instead of "troubleshoot", I should have used "identified" because that is the point of my small, temporary script change; to identify which field is throwing the error and correct the field's placement/position. As I mentioned in my previous post, the field appears to be a child of a group that doesn't exist. It's indented like it were a child of a group, but does not fall under a field group parent - at least not one that was visible. Attempts to resolve the problem required multiple attempts to move the field around, however, since I can't replicate the problem, I can't replicate the solution.
Comment #30
xaa CreditAttribution: xaa as a volunteer commentedsame warning here (on view mode teaser with DS). Here the issue was simply solved by deleting a fieldgroup item "disabled".
Comment #31
candelas CreditAttribution: candelas as a volunteer commentedI also had today this problem and solved deleting the field item. The notice appeared after rebuilding permissions. By the way, thanks for the module :)
Comment #32
ExTexan CreditAttribution: ExTexan commentedI also had this error. It was showing twice, after I had added two field groups. I fixed it by deleting and re-adding the groups.
The first time I added the groups, I had dragged them to where I wanted them. The second time, I did everything in separate steps... add - save - drag - save - move fields in groups - save.
Comment #33
GuyPaddock CreditAttribution: GuyPaddock at RedBottle Design, LLC for Inveniem commentedThis can happen if you try to create a field group, drag it into place, and then move fields under it, THEN save (i.e. you do all three in one save).
If you save right after creating the field group, and then drag it into place, this doesn't happen.
Comment #34
Rob C CreditAttribution: Rob C commentedThis occurs for me if i create a field group, add a field, then save, then drag the field to disabled while maintaining the weight (so it floats to the right a bit, like it would when actually inside a group). See the attachment for how it looks in the UI.
If you then load the page, the group will be empty for that field that still thinks it's inside a group and presto:
Notice: Undefined index: name in _field_ui_reduce_order() (line 81 of modules/field_ui/field_ui.admin.inc).
Can't reproduce it with fields at this time, but fields that i had disabled previously still have this issue. After reordering then and saving the form the error seems to be gone. So it's a bug, but how to solve this? Would have to test all fields in an update hook and make sure they do not contain any field group attributes/weights/positions when they are disabled.
Comment #35
simeWorkaround in #33 is consistent across a number of issues (if unfortunate), and marking this won't fix for aging D7 branch.