In hook_field_widget_form you should return the entire element again in the array under your value key. This way developers can acces the #entity_type, #bundle and #field_name properties when needed.
At Clientside Validation we need this to be able to validate the phone fields (we need to get the country code from the field settings, and thus we need the field's name to retrieve these settings).
All Drupal core modules follow this guideline, for example:
Number and Text Fields
Attached is a patch that fixes this.
| Comment | File | Size | Author |
|---|---|---|---|
| hook_field_widget_form_drupal_standards.patch | 692 bytes | jelle_s |
Comments
Comment #1
attiks commentedthis works
Comment #2
cweagansCommitted and pushed to 7.x-1.x
Comment #3.0
(not verified) commentedUpdated issue summary.