-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Drupal 9 Module Development
By :

The primary plugin type for creating a field is, as we discussed, the FieldType
. It is responsible for defining the field structure, how it is stored in the database, and various other settings. Moreover, it also defines a default widget and formatter plugin that will be auto-selected when we create the field in the UI. You see, a single field type can work with more than one widget and formatter. If more exist, the site builder can choose one when creating the field and adding it to an entity type bundle.
Otherwise, it will be the default; each field needs one because without a widget, users can't add data, and without a formatter, they can't see it. Also, as you'd expect, widgets and formatters can also work with more than one field type.
The field we will create in this section is for the license plate data, which, as we saw, needs two individual pieces of information: a code (such as the state code) and the number. License plates around the world...