When we go to the path /admin/structure/types/manage/article/fields
and use the Add new field
option or the Add existing field
option, does that create a field, create a field instance or attach a field instance? How to differentiate between them? So, programmatically, when to use field_create_field, field_create_instance and field_attach API?
In the field API documentation it only mentions the admin UI and never talks about the path where to create both fields and field instances. So it's confusing. I don't even know if I even make sense.
node/add/article
are field instances (which are reused at several different entity types). And fields at path/admin/structure/types/manage/article/fields
are fields. In database I don't see a field instance table but only field_data table which, I guess, we get when we first create a field at path/admin/structure/types/manage/article/fields
usingfield_create_field
. And an instance is then attached to a bundle (article in this case) that we see at pathnode/add/article
.