function _field_collection_devel_generate in Field collection 7
1 call to _field_collection_devel_generate()
- field_collection_devel_generate in ./
field_collection.module - Implements hook_devel_generate().
1 string reference to '_field_collection_devel_generate'
- field_collection_devel_generate in ./
field_collection.module - Implements hook_devel_generate().
File
- ./
field_collection.module, line 2103 - Module implementing field collection field type.
Code
function _field_collection_devel_generate($object, $field, $instance, $bundle) {
// Create a new field collection object and add fake data to its fields.
$field_collection = entity_create('field_collection_item', array(
'field_name' => $field['field_name'],
));
$field_collection->language = $object->language;
$field_collection
->setHostEntity($instance['entity_type'], $object, $object->language, FALSE);
devel_generate_fields($field_collection, 'field_collection_item', $field['field_name']);
$field_collection
->save(TRUE);
return array(
'value' => $field_collection->item_id,
'revision_id' => $field_collection->revision_id,
);
}