Alters the formatter settings form.
$element: Form array.
$form_state: The form state of the (entire) configuration form.
$context: An associative array with the following elements:
\Drupal\field_ui\DisplayOverView.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_field_formatter_settings_form_alter(&$element, &$form_state, $context) {
// Add a 'mysetting' checkbox to the settings form for 'foo_field' fields.
if ($context['field']['type'] == 'foo_field') {
$element['mysetting'] = array(
'#type' => 'checkbox',
'#title' => t('My setting'),
'#default_value' => $context['formatter']
->getSetting('mysetting'),
);
}
}