Closed (fixed)
Project:
Model Entities
Version:
7.x-1.0-alpha2
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2011 at 14:34 UTC
Updated:
25 Jan 2016 at 18:33 UTC
Jump to comment: Most recent
Comments
Comment #1
keyiyek commentedLet say you have all the base code for your entities and entity types up and working,
then you can create a new entity type
or
where $type is the name of your entity type and $values is an array with things such label & description.
Then you must define 2 thing: fields and instances.
Field is an array that says the type of data you are going to store, cardinality and other things
once you have defined a field you have to create it
Up to this you just created the field, you have to tell Drupal to wich kind of entities you want it to be attached (even more than one if you like), for this you have to define an instance (properly a field-instance). Again with the arrays:
after the definition you create it
you can have a look to http://drupal.org/project/examples there is the node examples that adds fields and instances, it works the same for entities
Comment #2
liquidcms commentedi dont think the above for adding an instance works. try this:
Comment #3
anybodyClosing this because there was no further feedback from @captaindav. Please tell us how you solved it if possible.
Should this be or is this documented somewhere?
Comment #5
shmeterlin commentedI'm also trying to figure how to add entities programmatically, the explanation in #1 is very vague. I'm trying to follow the node example but it's not that straight forward when applying here.