Custom Fields

Sometimes you need to create your own custom fields or group of fields to your models. This is a guide on how to do that. Although there is an example at the Examples for developers module, i found it lacking in some areas. So i decided to create my own example.

We will be leveraging the Field API to create our custom fields. which means we will need to create a FieldType, FieldWidget and FieldFormatter. we will create these files in the src/Plugin/Field/FieldType, src/Plugin/Field/FieldWidget and src/Plugin/Field/FieldFormatter directories.

Entity Reference and integerTwo Text FieldsTextfields, formatted text and numbersLinks and media elements

Last updated