Closed (won't fix)
Project:
Documentation
Component:
API documentation files
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Dec 2010 at 04:34 UTC
Updated:
26 Mar 2025 at 07:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
yched commentedRecategorizing.
Sounds correct, though. $form_state holds a number of important information, including the $field and $instance definition against which a widget is being generated.
Comment #3
yhager commentedRerolling, and setting back the status as before.
Any chance this would go in for D7? it holds back successful completion of imagefield_crop D7 version.
Comment #4
damien tournoud commented+1 here.
And yes, this FAPI property is completely undocumented.
Comment #5
webchickCommitted to HEAD. Thanks!
Moving to the documentation queue to get this property documented.
Comment #6
jhodgdonWhat are we documenting, and where does it need documenting -- update guide? docblocks for api.drupal.org? Is this an API change that needs to be announced?
A summary would be most helpful...
Comment #7
webchickHm. I can't help you out with a summary of what it does. But the #file_value_callbacks property is missing from http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....
Comment #8
jhodgdonThanks -- adding a tag for the FAPI reference...
So is this an API change that we should add to the 6/7 module update guide, and/or have rfay announce?
Comment #9
webchickThis isn't an API change, per se, it's a new capability. D6 and below didn't have a managed_file FAPI type.
Comment #10
jhodgdonRight, duh! :)
So the only place this needs to be documented is in the FAPI reference?
Comment #11
webchickI think so, yep!
Comment #12
jhodgdonFAPI reference file is in the Documentation project now.
Comment #13
jn2 commentedI've done some research to document this property and need some input. There's very little on d.o. or the web about it, so I've had to extrapolate from the one mention I could find in core and the related #value_callback. It looks like the value function should be about the same as for that property. Here's what I have so far:
________________________________________________
Used by: managed_file
Description: Lists the names of custom value functions that implement how user input is mapped to a managed_file element's #value property. The related #value_callback property only allows one function name, so this property fills the missing functionality to allow File fields to be extended through the Form API.
Values: A list of value function names called to set the #value property for the managed file element.
A value function for a managed_file element takes $element, $input and $form_state as parameters, and has the form:
----------------------------------------------------------------------------------
I'm not sure if the value function must include _file_ in its name.
You may notice that managed_file does not have default_value marked as available in the FAPI reference table. However, the managed_file usage example from core includes this property. So I'll also change that when I add the #file_value_callbacks property.
I couldn't find any usage examples for #file_value_callbacks. It's not necessary to have one, but if someone wants to contribute one, I'll include it.
Comment #14
sven.lauer commented#13 is a good start, but note that, unlike #value_callback callbacks, the file module does NOT assign the return value to the #value property. Indeed, it assumes that nothing is returned by the callback (and hence, I guess, that the $element property is modified in place.
Comment #15
carsteng commented#14 editing the referenced elements doesn't work....
here is the code snipped from file_managed_file_value() in file.module:
The import part is the return value. The #file_value_callbacks can only work (return or edit values) if element or input in the following part are merged into $return array. So in my point of view...at the moment this callback is almost useless... you can do only some additional calculations but u can't edit the element array.
Comment #16
sven.lauer commentedRe: #15
That is not quite true. If the callback takes $input by reference, it can manipulate it, and thus, e.g., set $input['fid'] to some (new) value. This would be picked up in
and then later merged into $return with
The documentation for this property should probably indicate that $input['fid'] is the thing to manipulate.
Comment #17
carsteng commentedyep. I know...but I cannot add some other keys.....
Comment #18
sven.lauer commented@lordgil: That's true. For now, let's document the current behavior, though. Then we might post a follow-up issue to the forms component asking for better behavior in 8.x.
Comment #19
jhodgdonTagging so #1421874: [meta] Documentation Issue Queue Cleanup doesn't have to look at API docs issues.
Comment #20
carsteng commentedComment #21
quietone commentedThis is for the Drupal 7 Form API reference. Since Drupal 7 is past end-of-life this is now a "won't fix".
Work on documentation for form elements for supported versions of Drupal is at #2486967: [meta] Move/Create Form Element Documentation and #3313535: [Meta] Improve documentation for Render and Form Elements.