1 field_example.module field_example_field_formatter_info()

Implements hook_field_formatter_info().

We need to tell Backdrop that we have two different types of formatters for this field. One will change the text color, and the other will change the background color.

See also

field_example_field_formatter_view()

Related topics

File

modules/examples/field_example/field_example.module, line 116
An example field using the Field Types API.

Code

function field_example_field_formatter_info() {
  return array(
    // This formatter just displays the hex value in the color indicated.
    'field_example_simple_text' => array(
      'label' => t('Simple text-based formatter'),
      'field types' => array('field_example_rgb'),
    ),
    // This formatter changes the background color of the content region.
    'field_example_color_background' => array(
      'label' => t('Change the background of the output text'),
      'field types' => array('field_example_rgb'),
    ),
  );
}