hook_field_formatter_third_party_settings_form doesn't fire I'm attempting to add a checkbox to a field settings form in D9. I have the following code:
function my_module_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, $form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $element = array();
  print '&lt;h1&gt;HERE&lt;/h1&gt;';

  if ($plugin
    -&gt;getPluginId() == 'text_textarea_with_summary') {
    $element['my_setting'] = array(
      '#type' =&gt; 'checkbox',
      '#title' =&gt; t('test'),
      '#default_value' =&gt; $plugin
        -&gt;getThirdPartySetting('my_module', 'my_setting'),
    );
  }
  return $element;
}

I then edit an instance of a body field (admin/structure/types/manage/article/fields/node.article.body), and the hook doesn't fire...no debug text nor stopping at the breakpoint on that same line.
There are two problems.
/admin/structure/types/manage/article/fields/node.article.body is the path of a field setting. To trigger the hook you need to visit /admin/structure/types/manage/article/display.
The plugin ID is wrong, too. text_textarea_with_summary is the plugin ID of a widget. What you are looking for is probably the formatter text_summary_or_trimmed.
If this is neither formatter nor widget, but the content type specific field definition, then use a normal form alter hook, because there is no specific hook to add third party settings:
use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_form_FORM_ID_form_alter().
 */
function my_module_form_field_config_edit_form_alter(array &amp;$form, FormStateInterface $form_state) {
  /** @var \Drupal\Core\Field\FieldConfigInterface $field */
  $field = $form_state-&gt;getFormObject()-&gt;getEntity();
  if ($field-&gt;getType() == 'text_with_summary') {
    $form['third_party_settings']['my_module']['my_setting'] = [
      '#type' =&gt; 'checkbox',
      '#title' =&gt; t('test'),
      '#default_value' =&gt; $field-&gt;getThirdPartySetting('my_module', 'my_setting'),
    ];
  }
}

Edit: The form keys $form['third_party_settings']['my_module']['my_setting'] are important. They are used to submit the third party settings.