How can I get the field formatter settings inside a field plugin? The field plugin extends FieldItemBase and the corresponding field formatter plugin extends FormatterBase.
If there is no direct way, maybe I could use the entity_display.repository service. But to use the getViewDisplay I need to know which view mode is used. I don't know either how to get the current view mode in the field plugin.
The field plugin is a computed field that makes a calculation depending on some variables. I wanted to set theses variables as the formatter settings. But maybe this is the wrong approach. Maybe it would be better to use module settings for this purpose?