Answer:- In Drupal 7 each individual node, user, term and comment is now called an entity.
Nodes (content), comments, taxonomy terms and users profiles are now called entity types.
You can also build new kinds of entity types where the options above don't suit your needs. For more information, read further about using the hook_entity_info and extension by Entity API: entity_crud_hook_entity_info.
In OOP terminology concept of entities is like:
You can use entity_load to load any entity. Note, however, that the core does not provide a save or delete function, but thanks to Entity API module the missing pieces are added (entity_create(), entity_save(), entity_delete(), entity_view() and entity_access()).
Difference b/w Drupal 6 concept of nodes and Drupal 7 concept of entities
Imagine that you want to collect more than information when people leave comments. If you want to collect more than name, email and comment, you can add a field. For example, you might want to allow commenters to leave a link to their homepage. Let's assume that is the case for our Article content type.
This was not possible in Drupal 6 with concept of nodes but with Drupal 7 it is in following manner:
Nodes (content), comments, taxonomy terms and users profiles are now called entity types.
You can also build new kinds of entity types where the options above don't suit your needs. For more information, read further about using the hook_entity_info and extension by Entity API: entity_crud_hook_entity_info.
In OOP terminology concept of entities is like:
- An entity type is a base class
- A bundle is an extended class
- A field is a class member, property, variable or field instance (depending on your naming preference)
- An entity is an object or instance of a base or extended class
Bundles
Bundles are an implementation of an entity type to which fields can be attached. You can consider bundles as subtypes of an entity type. With content nodes (an entity type), for example, you can generate bundles (subtypes) like articles, blog posts, or products.Fields
A field is a reusable piece of content. In technical terms, each field is a primitive data type, with custom validators and widgets for editing and formatters for display.Entity
An entity would be one instance of a particular entity type such as a comment, taxonomy term or user profile or a bundle such as a blog post, article or product.You can use entity_load to load any entity. Note, however, that the core does not provide a save or delete function, but thanks to Entity API module the missing pieces are added (entity_create(), entity_save(), entity_delete(), entity_view() and entity_access()).
Difference b/w Drupal 6 concept of nodes and Drupal 7 concept of entities
Imagine that you want to collect more than information when people leave comments. If you want to collect more than name, email and comment, you can add a field. For example, you might want to allow commenters to leave a link to their homepage. Let's assume that is the case for our Article content type.
This was not possible in Drupal 6 with concept of nodes but with Drupal 7 it is in following manner:
- Click on Structure in the black admin menu bar
- Click on Content types
- Click on Manage fields for the Article content type
- Observe the tabs shown in the screen shot above.
- You have the option to add fields to the content type via the Manage Fields tab and you have the option to add fields to comments via the Comment Fields tab. The fields you add to the Article content type will not automatically apply to comments on other content types.
No comments:
Post a Comment