/**
 * Implements hook_field_formatter_settings_summary_alter().
 */
function {{ machine_name }}_field_formatter_settings_summary_alter(array &$summary, array $context) {
  // Append a message to the summary when an instance of foo_formatter has
  // mysetting set to TRUE for the current view mode.
  if ($context['formatter']->getPluginId() == 'foo_formatter') {
    if ($context['formatter']->getThirdPartySetting('my_module', 'my_setting')) {
      $summary[] = t('My setting enabled.');
    }
  }
}
