I am creating a form to collect data for a specific content type which has a field collection in it.
So basically I am creating nodes manually through form API. What I need to do is to add a field collection table to my form which corresponds to the field collection I declared in the node type.
I have got how the table is rendered in the original add content form, which is like this:
[field_student_grades] => Array
(
[#type] => container
[#attributes] => Array
(
[class] => Array
(
[0] => field-type-field-collection
[1] => field-name-field-student-grades
[2] => field-widget-field-collection-table
)
)
[#weight] => 5
[#tree] => 1
[#language] => und
[und] => Array
(
[0] => Array
(
[#entity_type] => field_collection_item
[#entity] => FieldCollectionItemEntity Object
(
[fieldInfo:protected] =>
[hostEntity:protected] => stdClass Object
(
[uid] => 1
But I do not know how to deal with the [und] and [hostEntity:protected] and stdClass Object in code.