Closed (outdated)
Project:
Drupal core
Version:
11.x-dev
Component:
field system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 May 2011 at 11:43 UTC
Updated:
1 Sep 2024 at 09:12 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
damien tournoud commentedWe need something like this.
Comment #2
damien tournoud commentedComment #3
msbrar commentedI am getting errors in field_info_max_weight while trying to do "Manage Fields" in content types which have multi lingual support set to "Enabled with translation". The manage fields page goes blank with error. The following code is causing problem (even when the $context variable is set to forms. the above patch did not work for me)
// Collect weights for extra fields.
foreach (field_info_extra_fields($entity_type, $bundle, $context) as $extra) {
$weights[] = $extra['weight'];
}
The $extra['weight'] returns an array in the above case while trying to "Manage Fields". I replaced the above code with the following code and it seems to work for me.
// Collect weights for extra fields.
foreach (field_info_extra_fields($entity_type, $bundle, $context) as $extra) {
$weight_var = $extra['weight'];
if(is_array($weight_var)) {
$weights = array_merge($weights, $weight_var);
}
else {
$weights[] = $weight_var;
}
}
i.e. merging in case the var $extra['weight'] is an array. I do not have any clue about how drupal works internally, but the above just seems to solve my problem. Can anybody please help me with the proper fix for this.
Comment #4
yched commentedWow, this stayed out of my radar for some time...
I see two errors in field_info_max_weight() :
- field_info_extra_fields() should be called with either 'form' or 'display', while field_info_max_weight() calls it with the name of a view mode.
- in case of 'display', as Damien pointed, field_info_extra_fields() returns weights indexed by view modes, and we need to get the weight of the right view mode.
Attached patch should fix this. @msbrar, does this fix your issue ?
Comment #6
yched commentedSmall logic error in patch #4.
Comment #7
damien tournoud commentedThis still looks wrong to me. Why are you calling
field_info_extra_fields()repetitively for every instance?Comment #9
yched commentedDoh. This is starting to be embarrassing...
Comment #10
damien tournoud commentedComment #11
chx commentedI am surprised two veterans getting to this point without a test.
Comment #12
yched commentedAdded tests.
Comment #13
msbrar commentedThe above patches did not help me. I tested with drupal 7.8 earlier and am testing with 7.9 now. i tried different combinations but the problem still persists. Manage Fields presents a blank page if the content type has "enabled with translation" option selected for multilingual options.
However a workaround that is working for me is to disable the translation, add/manage fields and then turn it on again from the edit page.
Comment #14
yched commented@msbrar : this is unrelated, the minor bug fixed here has never caused WSODs or fatal errors. Please open a new issue for the bug you describe.
Other than that, RTBC, anyone ? Before nov. 1st great patch-break storm ?
Comment #15
xjmPatch-break storm has struck. :) So it will need to be rerolled. Tagging as novice for that task.
If you need help rerolling this patch, you can come to core office hours or ask in #drupal-gitsupport on IRC.
Comment #16
kathyh commentedRerolled per #15
Comment #17
xjmThanks!
Comment #18
yched commented#16: field_info_max_weight-1174100-16.patch queued for re-testing.
Comment #19
kscheirer#16: field_info_max_weight-1174100-16.patch queued for re-testing.
Comment #21
jhedstromIs this still an issue in 8.x?
Comment #35
quietone commented9 years ago it was asked if this is still an issue in Drupal 8+. There has been no reply confirming that which suggests that this is outdated. However, let's do one last check.
Is this still relevant?
Since we need more information to move forward with this issue, I am setting the status to Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #36
quietone commentedThere hasn't been confirmation that this problem still exits since asking 5 moths ago. Therefor closing.
If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").
Thanks!