I want to create a field collection to group two fields in a content type programmatically so that when the user installs the module, the module installs the content type and let the user create content through 'Add Content' option .

I have created the field using field_create_field function in HOOK_install. I have created two fields and field collection. I dont know how to link the field collection with the two fields. I have searched over forum and I came across various materials just explaining how to add,edit and delete values of field collection programmactically but I could not find any useful information on how to create field collection in content type. Any help on this topic will be much appreciated.

In my code to create the content type with the field collection,the content type is created well with the field collection but when I check in the structures -> field Collection -> field_group->manage field, The fields are not getting displayed there and when I go to 'add content' the field collection does not have those fields but the fields are displayed outside the field collection container

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.