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 '<h1>HERE</h1>';
if ($plugin
->getPluginId() == 'text_textarea_with_summary') {
$element['my_setting'] = array(
'#type' => 'checkbox',
'#title' => t('test'),
'#default_value' => $plugin
->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.