Example: Field Types API in Examples for Developers 3.x
Same name and namespace in other branches
- 8 field_example/field_example.module \field_example
- 7 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 - An example field using the Field Types API.
Classes
Name | Location | Description |
---|---|---|
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. |