Summary
In this chapter, we looked at how we can create custom fields that site builders (and developers) can add to entity types. This implied defining three plugin types: FieldType
, FieldWidget
, and FieldFormatter
, each with its own responsibility. The first defined the actual field, its storage, and individual data properties, using the TypedData API. The second defined the form through which users can input field data when creating or editing entities that use the field. The third defined how the values inside this field can be displayed when viewing the entity.
We also saw that each of these plugins can have custom sets of configurable settings that can be used to make the field dynamic—both in how the widget works and in how the values are displayed. Moreover, these settings are part of the exported field configuration, so we saw how we can define their respective configuration schemas.
Lastly, we also saw how—aside from creating our new field through the...