Example: Field Types API
Same name in other branches
- 7.x-1.x field_example/field_example.module \field_example
- 4.0.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
-
modules/
field_example/ field_example.module, line 8
Classes
Title Sort descending | File name | Summary |
---|---|---|
ColorBackgroundFormatterTest | modules/ |
Test the basic functionality of Color background formatter. |
ColorPickerWidgetTest | modules/ |
Test the basic functionality of Color Picker Widget. |
FieldExampleMenuTest | modules/ |
Test the user-facing menus in Field Example. |
TextWidgetTest | modules/ |
Test basic functionality of the widgets. |