Last updated February 27, 2014. Created by targoo on July 29, 2013.
Edited by intervalle. Log in to edit this page.

This page is outdated and needs rewriting. The hook_field_info didn't exist anymore in D8 and is replaced by the use of a field.field.[entity_type].[field_name].yml file in your custom module.

Hooks required for a field formatter

The following list of hooks are required to implement a custom field.



1)Use annotation to define your formatter.

* Plugin implementation of the 'module_plain' formatter.
* @FieldFormatter(
*   id = "module_plain",
*   module = "module",
*   label = @Translation("Plain"),
*   field_types = {
*     "module_field"
*   }
* )

2) Create your class which extends FormatterBase


  • Email (core module)
  • Telephone (core module)
  • Color Field

Looking for support? Visit the forums, or join #drupal-support in IRC.