Hello I have encountered an error in the function field_extra_fields. The problem is on the line 398 of file field.module:
function field_extra_fields($bundle_name)
.
.
.
$extra = module_invoke_all('field_extra_fields', $bundle);
$bundle is passed to the function but it only gets the name of the $bundle examples(node, file, user). When for example I add extra fields a particular node type can not add that I have no way of identifying the type of content. I think what he wants to spend is $ bundle_label. Additionally $bundle_label variable name in foreach does not make sense.
Comments
Comment #1
fastangel commentedAn example of the bug is in the poll module.
Comment #2
yched commentedTrue, that hook needs to receive $obj_type as well, as its first param. Leftover from #470242: Namespacing for bundle names.
Comment #3
yched commentedHere's a patch:
- adds an $obj_type param to field_extra_fields(). Since #470242: Namespacing for bundle names, $bundle is not enough to uniquely qualify a bundle.
- refactors hook_field_extra_field() so that it is called once, instead of once per bundle.
- stores the extra field weights in a single variable, instead of one per bundle.
- moves the field_attach_extra_weight() API func from field.attach.inc to field.module. Nothing to do in 'attach'.
Comment #4
yched commentedclearer title + easier self tracking
Comment #5
dries commentedI committed this to CVS HEAD but it would be great to get confirmation from fastangel that this is fixed. We should also make sure this is covered by tests.
Comment #6
fastangel commentedAlready fixed the problem. The hook is working properly. Además pasa los test sin problemas.
Thanks
Comment #7
sun.
Comment #8
jhodgdonCan you clarify sun why you tagged this issue with "needs documentation"? What needs to be documented?
Comment #9
sunIf I'm not mistaken, that same code has been changed some more times in the meantime, so documentation needs to happen elsewhere (or happened already).
Dries asked for tests though.
Comment #10
Tor Arne Thune commentedComment #29
quietone commentedThis was committed in 2010 are remains open for tests. As far as I can tell tests were added in #2225629: Move hook_field_extra_fields() to the entity API.
I have updated credit and am closing this as fixed on the branch the commit was made.