Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the Field API documentation at http://api.drupal.org/api/drupal/modules--field--field.module/group/field/7 #object is not documented.
It is, however, causing errors for me, so it would be good to document what #object refers to, and whether it is mandatory or optional (i.e. if it can be removed without any adverse side-effects.)
Comment | File | Size | Author |
---|---|---|---|
#6 | doc-field-API-render-info-1310164-6.patch | 548 bytes | sven.lauer |
Comments
Comment #1
jhodgdonUm. What is #object, and where/how is it causing you problems?
Comment #2
Mark_L6n CreditAttribution: Mark_L6n commentedI don't know what it is, it's not documented! But the Field render arrays I have examined with dpm() have it, with a value of 'stdClass'. I have tried printing them out to see what is inside but have failed so far. I was wondering if they were pointers to an enclosing object for context purposes, but that's only a wild guess.
As for the error, I am copying fields from a node to a QuickTabs tab inside that node and receiving an 'Uncaught exception thrown in session handler.' error message. Unsetting '#object' takes care of the message, but I don't know if doing this could have any bad side-effects. I'm asking about this at http://drupal.org/node/1310152
As an aside, I hope I am posting to the right place for documentation requests--I read to not post in the comments section but in the documentation issue queue. Please advise if I should post elsewhere. (Edit: I changed version # to 7.8, thinking I had made an error, but then saw you had changed it to 8. Apologies.)
Comment #3
jhodgdonOh, the field *render* arrays. That is not what is documented on the Field API page, and I don't know off-hand what they contain, or where they are documented (if anywhere actually).
And yes, this is the right place to post for documentation on api.drupal.org.
Comment #4
sven.lauer CreditAttribution: sven.lauer commentedThis actually IS documented at field_attach_view(), where a "sample structure" is given, containing:
http://api.drupal.org/api/drupal/modules--field--field.attach.inc/functi...
Works as designed? Or should we link to this information from somewhere? It is not obvious for someone theming an entity etc. that this would be documented at field_attach_view() ...
Comment #5
jhodgdonThanks for the detective work!
It makes sense to me that after the description of the $field and $instance arrays, we could add a line saying something like "See field_attach_view() for documentation of the render array for formatting a field." (or maybe you can come up with better wording)
Comment #6
sven.lauer CreditAttribution: sven.lauer commentedRolling a patch based on jhodgdon's suggestion in #5 (different wording, though).
Comment #7
jhodgdonLove it. Thanks!
Oh, this should be 8.x. Just in case, I'll push the "retest".
Comment #8
jhodgdon#6: doc-field-API-render-info-1310164-6.patch queued for re-testing.
Comment #9
webchickCommitted and pushed to 8.x and 7.x. Thanks!