How to specify default formatter for custom field widget? I created a custom field widget implementing hook_field_widget_info(), created a custom formatter implementing hook_field_formatter_info() and also implemented hook_field_formatter_view() to generate the formatter's display.

Everything works as intended (validation, persisting values, formatter) with one glaring exception: I can't figure out how to make my widget use my formatter by default.

Every time I add a an iToggle field I need to manually change its formatter in Manage Displays for that content type.

Any ideas?

Here's my code:

function itoggle_field_field_widget_info() {
 return array(
   'itoggle' =&gt; array(
    'label' =&gt; t('iToggle Widget'),
    'field types' =&gt; array('list_boolean'),
    'settings' =&gt; array('display_label' =&gt; 1),
    'behaviors' =&gt; array(
      'multiple values' =&gt; FIELD_BEHAVIOR_CUSTOM,
    ),
  ),
);
}

function itoggle_field_field_formatter_info() {
  return array(
    'itoggle' =&gt; array(
    'label' =&gt; t('iToggle Widget'),
    'description' =&gt; t('Displays the field as an iToggle Widget'),
    'field types' =&gt; array('list_boolean'),
  ),
);
}


Thanks!
Short answer is you can't. You can only specify a default formatter for each field type itself in hook_field_info():


  default_formatter: The machine name of the default formatter to be used by instances of this field type, when no formatter is specified in the instance definition. This formatter must be available whenever the field type is available (i.e. provided by the field type module, or by a module the field type module depends on).