Skip to main content
2 of 2
added 275 characters in body
Jaypan
  • 18k
  • 3
  • 34
  • 65

You wouldn't. The field definition (extending FieldItemBase) is the data definition, without any representation on how that data should be displayed. Fields are are not meant to be dependent upon a single formatter, but rather can have any applicable formatter used for the field. This is a purposeful disambiguation. Formatters provide different ways of displaying the field data. So if you are trying to get formatter info in the field definition, it's backwards. You should only be getting field data from the formatter, not the other way around.

Based on your update, you want instead to create a computed field. You can do this by creating a custom plugin, or using the Computed Field module.

Jaypan
  • 18k
  • 3
  • 34
  • 65