Example: Field Types API in Examples for Developers 8
Same name and namespace in other branches
- 7 field_example/field_example.module \field_example
- 3.x modules/field_example/field_example.module \field_example
Examples using Field Types API.
Providing a field requires:
- Defining an entity field item. Entity field items are typed data objects containing the field values.
- Defining a field type schema at config/schema/[module_name].schema.yml
- config/schema/field_example.schema.yml
 
- One or more widgets specifying how the field appears in edit forms
- Drupal\field_example\Plugin\Field\TextWidget
- Drupal\field_example\Plugin\Field\Text3Widget
- Drupal\field_example\Plugin\Field\ColorPickerWidgetWidget
 
- One or more formatters specifying how the field appears in displayed
entities
- Drupal\field_example\Plugin\FieldFormatter\SimpleTextFormatter
- Drupal\field_example\Plugin\FieldFormatter\ColorBackgroundFormatter
 
End of "defgroup field_example".
See also
Parent topics
File
- field_example/field_example.module, line 8 
- An example field using the Field Types API.
Classes
| Name   | Location | Description | 
|---|---|---|
| ColorBackgroundFormatterTest | field_example/ | Test the basic functionality of Color background formatter. | 
| ColorPickerWidgetTest | field_example/ | Test the basic functionality of Color Picker Widget. | 
| FieldExampleMenuTest | field_example/ | Test the user-facing menus in Field Example. | 
| TextWidgetTest | field_example/ | Test basic functionality of the widgets. | 
