Example: Field Types API in Examples for Developers 7
Same name and namespace in other branches
- 8 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 a field:
- Defining a formatter for the field (the portion that outputs the field for display):
- Defining a widget for the edit form:
Our module defines the field in field_example_field_info(), field_example_field_validate() and field_example_field_is_empty(). field_example_field_schema() is implemented in field_example.install.
Our module sets up a formatter in field_example_field_formatter_info() and field_example_field_formatter_view(). These are the API hooks that present formatted and themed output to the user.
And finally, our module defines the widget in field_example_field_widget_info() and field_example_field_widget_form(). The widget is the form element used to receive input from the user when the field is being populated.
See also
Parent topics
File
- field_example/
field_example.module, line 7 - An example field using the Field Types API.
Functions
Classes
Name | Location | Description |
---|---|---|
FieldExampleTest |
field_example/ |
Functional tests for the Field Example module. |