API page: http://api.drupal.org/api/drupal/modules--field--field.attach.inc/functi...

Describe the problem you have found:

Lack of data format definition. I had a field attached to an entity via the field UI. in the submit function I need to insert data from another form into this field but the entity only had an empty array.

Would be nice if the "$entity->{field name} = array( {language} => array (0 => array('value' => {value to insert})));" was documented. Probably better to put it in the Field API overview.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Novice, +Needs backport to D7

This structure is actually documented on this page:
http://api.drupal.org/api/drupal/modules--field--field.multilingual.inc/...

But it would probably be good if the Field Attach API topic linked to the Field Language topic to indicate this. Good novice project I think?

jhodgdon’s picture

Title: Documentation problem with field_attach_submit » Field Attach API topic/group page should link to Field Language API page
chris.leversuch’s picture

Assigned: Unassigned » chris.leversuch
Status: Active » Needs review
FileSize
552 bytes

Something like this?

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That link looks fine, yes. Thanks!

Note that this patch will interfere with the patch for #1349610: make the subtopics of Field API link back to it. One of them will need a reroll when the other is committed.

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Looks good. Committed/pushed to 8.x.

chris.leversuch’s picture

Status: Patch (to be ported) » Needs review
FileSize
535 bytes

Here's a D7 version.
I noticed that language didn't have a L - is that a problem?

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

This patch is fine. We have differing standards on "Sentence case" vs. "Title Case" in Drupal documentation, and I'm not too particular about enforcing either one.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

No longer applies, most likely due to #1349610: make the subtopics of Field API link back to it.

chris.leversuch’s picture

Status: Needs work » Needs review
FileSize
617 bytes

Here's a new patch

sven.lauer’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Perfect, thanks!

Committed and pushed to 7.x.

Automatically closed -- issue fixed for 2 weeks with no activity.