1 field_group.api.php hook_field_group_formatter_info()

Implements hook_field_group_formatter_info().

Define the information on formatters. The formatters are separated by view mode type. We have "form" for all form elements and "display" will be the real view modes (full, teaser, sticky, ...)

structure:

array(
  'form' => array(
    'fieldset' => array(
      // required, String with the name of the formatter type.
      'label' => t('Fieldset'),
      // optional, String description of the formatter type.
      'description' => t('This is field group that ...'),
      // required, Array of available formatter options.
      'format_types' => array('open', 'collapsible', 'collapsed'),
      // required, String with default value of the style.
      'default_formatter' => 'collapsible',
      // optional, Array with key => default_value pairs.
      'instance_settings' => array('key' => 'value'),
    ),
  ),
  'display' => array(
    'fieldset' => array(
      // required, String with the name of the formatter type.
      'label' => t('Fieldset'),
      // optional, String description of the formatter type.
      'description' => t('This is field group that ...'),
      // required, Array of available formatter options.
      'format_types' => array('open', 'collapsible', 'collapsed'),
      // required, String with default value of the style.
      'default_formatter' => 'collapsible',
      // optional, Array with key => default_value pairs.
      'instance_settings' => array('key' => 'value'),
    ),
  ),
),

Return value

array: A collection of available formatting html controls for form and display overview type.

See also

field_group_field_group_formatter_info()

Related topics

File

core/modules/field_group/field_group.api.php, line 89
Hooks provided by the Field Group module.

Code

function hook_field_group_formatter_info() {
  return array(
    'form' => array(
      'fieldset' => array(
        'label' => t('Fieldset'),
        'description' => t('This field group renders the inner content in a fieldset with the title as legend.'),
        'format_types' => array('open', 'collapsible', 'collapsed'),
        'instance_settings' => array('classes' => ''),
        'default_formatter' => 'collapsible',
      ),
    ),
    'display' => array(
      'div' => array(
        'label' => t('Div'),
        'description' => t('This field group renders the inner content in a simple div with the title as legend.'),
        'format_types' => array('open', 'collapsible', 'collapsed'),
        'instance_settings' => array(
          'effect' => 'none', 'speed' => 'fast', 'classes' => '',
        ),
        'default_formatter' => 'collapsible',
      ),
    ),
  );
}