官术网_书友最值得收藏!

Fields

Now that we have an idea of what entities are, let's take a look at how data is actually stored on these entities.

I have alluded in the preceding section to how certain entity bundles can have various fields. This means that each entity type bundle can have any number of fields that are responsible for holding data. Additionally, each entity type itself can have fields for storing data. Okay, but what? Let's break this down.

There are two types of fields in Drupal 8—base fields and configurable fields. The former are fields that are defined in the code for each entity type, whereas the latter are usually created and configured in the UI and attached to a bundle of that entity type (and exported via configuration).

Fields can also be of multiples types, depending on the data they store. You can have string (or text) fields, numeric fields, date fields, email fields, and so on. As developers, we can create our own field types if the existing ones are not good enough for our data.

In this book, we will take a look at how we can define base fields on a certain entity type and create our own field type with its own data input widget and output formatter. Site builders can then use this field type on any entity type.

主站蜘蛛池模板: 常州市| 东至县| 政和县| 平原县| 河西区| 泰来县| 东阳市| 绥德县| 沿河| 彭州市| 建水县| 桑日县| 沂源县| 思茅市| 湾仔区| 嘉祥县| 宁明县| 肇州县| 儋州市| 定日县| 九寨沟县| 瓮安县| 合阳县| 恭城| 阿城市| 广元市| 海丰县| 炎陵县| 顺昌县| 杂多县| 延长县| 静海县| 商丘市| 二手房| 仁布县| 凌源市| 新和县| 林甸县| 安陆市| 娄底市| 兰考县|