Creating a custom field

by Gisle Hannemyr

Mumble

Table of contents

Source: Berdir,

Introduction

This chapter will show how to create a "basic" custom field in Drupal 8. It will go into detail about PSR-4, annotations or plugins. Please see Drupal 8 (and later) principles for a general introduction.

In Drupal 8 and later, fields are not implemented using hooks like they are in Drupal 7. Instead, they are created using Drupal 8's new Plugin API. This means that instead of implementing hooks, we define a class for a widget, formatter and field item.

Note that most Drupal 7 field hooks like hook_field_schema, hook_field_is_empty and more, are now methods in classes.

For and example

Final word

[TBA]


Last update: 2021-08-30 [gh].