- Drupal 8 Module Development
- Daniel Sipos
- 393字
- 2021-07-02 12:22:34
Entities
Progressively, entities have become a very powerful way of modeling data and content in Drupal. The most famous type of entity has always been the Node, and it has been historically the cornerstone of content storage and display. In Drupal 8, the entire entity system has been revamped to make other entity types potentially just as important. They have been brought to the forefront and have been properly connected with other systems.
All entity types can have multiple bundles, which are different variations of the same entity type and can have different fields on them (while sharing some base fields).
Drupal core still ships with the Node entity type, with a few bundles such as Basic Page and Article in its standard installation profile. In addition, it comes with a few other entity types, such as User, Comment, and File. However, creating your own entity type in Drupal 8 has become much more standardized compared to Drupal 7 where contributed modules had to be brought into play.
These are not the only types of entities we have in Drupal 8. The aforementioned examples are all content entity types. Drupal 8, however, also introduced the configuration entity types. The former are for modeling content, but in reality, they are for anything that holds data that can be stored in the database and is specific to that environment. They are not used for storing configuration, though. Users and content are great examples, as they do not need to be (usually) deployable from one environment to another. The latter, on the other hand, are exportable items of configuration, of which there can be more than one. For example, a content entity bundle is a great example because there can be more than one bundle for a certain entity type; they have some metadata and information stored that can differ from bundle to bundle, and they need to be deployed on all environments. That is, they are fundamental to the correct functioning of the site.
Understanding the entity system is indispensable for doing development in Drupal 8 because it provides a powerful way to model custom data and content. Nodes are not the only tool for the job and in my opinion, they were used in previous Drupal versions way past their purpose due to the lack of a proper entity architecture.
- Learning Java Functional Programming
- Python數(shù)據(jù)分析基礎(chǔ)
- Apache Hive Essentials
- 樂高機(jī)器人設(shè)計(jì)技巧:EV3結(jié)構(gòu)設(shè)計(jì)與編程指導(dǎo)
- 程序員考試案例梳理、真題透解與強(qiáng)化訓(xùn)練
- Spring+Spring MVC+MyBatis從零開始學(xué)
- Struts 2.x權(quán)威指南
- MySQL 8從零開始學(xué)(視頻教學(xué)版)
- ROS機(jī)器人編程實(shí)戰(zhàn)
- C語言從入門到精通(視頻實(shí)戰(zhàn)版)
- Unreal Engine Game Development Cookbook
- 情境微課開發(fā)(第2版)
- Raspberry Pi By Example
- Python High Performance(Second Edition)
- Java編程動(dòng)手學(xué)