Example: Field Types API

Same name in other branches
  1. 3.x modules/field_example/field_example.module \field_example
  2. 8.x-1.x field_example/field_example.module \field_example
  3. 4.0.x modules/field_example/field_example.module \field_example

Examples using Field Types API.

Providing a field requires:

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

Field Types API

Field API

Parent topics

File

field_example/field_example.module, line 7

Functions

Title Sort descending File name Summary
field_example_3text_validate field_example/field_example.module Validate the individual fields and then convert to RGB string.
field_example_field_formatter_info field_example/field_example.module Implements hook_field_formatter_info().
field_example_field_formatter_view field_example/field_example.module Implements hook_field_formatter_view().
field_example_field_info field_example/field_example.module Implements hook_field_info().
field_example_field_is_empty field_example/field_example.module Implements hook_field_is_empty().
field_example_field_schema field_example/field_example.install Implements hook_field_schema().
field_example_field_validate field_example/field_example.module Implements hook_field_validate().
field_example_field_widget_error field_example/field_example.module Implements hook_field_widget_error().
field_example_field_widget_form field_example/field_example.module Implements hook_field_widget_form().
field_example_field_widget_info field_example/field_example.module Implements hook_field_widget_info().
field_example_menu field_example/field_example.module Implements hook_menu().
_field_example_page field_example/field_example.module A simple page to explain to the developer what to do.

Classes

Title Sort descending File name Summary
FieldExampleTest field_example/field_example.test Functional tests for the Field Example module.