I've been building custom entities for a while now, but have been using the entity construction kit (eck) to build them. This has limitations as it requires you to #1 depend on the package for new installs, and #2, wrap your entities into a feature and hope there aren't conflicts later.
I would like to get into the world of building out the entity types programatically, on module install, as well as removing them on module uninstall.
I was recently diving into an ECK created entity I made that I exported into a feature, and it looks like the feature for the entity type is in the correct format for if you were to programatically create the entity. I have been trying to learn by looking at documentation on how to build a custom fieldable entity (with bundle) for a while, but all the documentation I have found has either been inconsistent, or spread all over the place making it difficult to follow.
My question is, could I in theory copy the field_instance.inc
, field_base.inc
, and the features.inc
(where the entity is defined at), and plug that into my modules hook_install()
and create my entity inside of the install file, instead of having to rely on ECK and features? I should note that I am also using the conditional_fields module so that I can dyanmically show/hide certain fields inside of this entity and save time on building my own ajax functionality, so I would probably need to build the entity out so that the fields can be updated from the Fields UI if needed (but usually they'll be updated in hook_update_N
.
user
andnode
core modules to get a good idea. I think I have a good understanding now of what I need to do :)