In "field.crud.inc" the documentation for field_create_instance() has a mistake.
It says that "weight" is a property of "instance", when in reality, it must be a property of "widget".
It is used by _field_write_instance() to set the weight of the widget for the given bundle.
References:
field_create_instance()
_field_write_instance()
Cheers
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | drupal.1107376-5.patch | 516 bytes | jhedstrom |
Comments
Comment #1
jhodgdonHm. Really? I think that the instance has a weight also for purposes of displaying the fields on (for instance) the node/# page, which has nothing to do with widgets?
Comment #2
jm.federico commentedIt is the widget's weight the one that controls where the info ins displayed.
I've checked the code and everywhere it is used, it uses the widget's weight.
Comment #3
jhodgdonHm. It looks to me as though _field_write_instance (see link above in original issue report) is using both the widget's weight and the display mode formatter's weight:
So it does look like weight is not a property of the instance itself, and the doc should just have the weight item removed from it.
Comment #4
jhodgdonShould be fixed in 8.x first then 7.x
Comment #5
jhedstromHere's a patch against 8.x that simply removes the weight property from the doc for field_create_instance().
Comment #6
jhodgdonThanks jhedstrom! Patch looks good for d8 and d7.
Comment #7
yched commentedYup, remnant of the time when fields where not reorderable view mode by view mode, i.e. weight was for the instance as a whole. That one occurrence got overlooked.
Confirming rtbc.
Comment #8
dries commentedCommitted to 7.x and 8.x. Thanks.