Drupal Entitity Type , Bundles ( Content Type ), Fields
If you are a drupal leaner , you might heard about Entity Type. This is one of the main changes in Drupal 7 . Drupal 7 comes with this system. We can make Entity Type in Drupal, then can create bundle from it .also known as Content Type. After we can add fields to it and create entities on that . So, in this article we will be discussing regarding Drupal Entity Type->bundles->Fields.
Consider following , Its illustrating Drupal default entity type
Previously in drupal, it was only possible to add field in content but now in Drupal 7 we can add fields even in comments, users, taxonomy etc. Now we can build our custom entity type ,if default entity type does not fit as per our requirements . Check hook_entity_info This all because of now we have entity API in Drupal 7 .In Drupa 7 following are default entity type
Bundles like sub type of entity type . Bundles are also known as ” Content Type “. you might well familiar with this term. Entity type have bundles but not mandatory for all entity type that should have at least a bundle . For example user entity type have no any bundle associated with that .
Consider a drupal default entity type “node”. It has default 2 bundles basic page and article. Later we can attach field to a bundle. For example adding resume upload in user registration page.
Fields relate to entity type. We can attach field to any bundle . fields have there own validators, data type and widgets for displaying .This is important to organize data inside our drupal site . Lets consider an example you have to create 2 bundle one is for storing employee and other for it’s salary. So there may be different fields attach to employee and salary bundles. Read more about Drupal 7 fields API
Simply entity are data that we put inside any fields of bundle, entity type, it is also considered as instance of entity type like user profile, content, comments etc.
Drupal core does not provide entity CRUD function . But using Entity API ,it provide entity_save(), entity_create(), entity_delete(), entity_view() functions that really useful and fullfll the drupal core missing parts. We can load any entity with entity_load() function