function field_info_formatter_types

Returns information about field formatters from hook_field_formatter_info().

Parameters

string $formatter_type: (optional) A formatter type name. If omitted, all formatter types will be returned.

Return value

array Either a single formatter type description, as provided by class annotations, or an array of all existing formatter types, keyed by formatter type name.

Related topics

9 calls to field_info_formatter_types()
Field::buildOptionsForm in drupal/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
Default options form that provides the label widget that all fields should have.
FieldInfoTest::testSettingsInfo in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
Test that the field_info settings convenience functions work.
FieldInstanceCrudTest::testCreateFieldInstance in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php
Test the creation of a field instance.
FieldInstanceCrudTest::testUpdateFieldInstance in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php
Test the update of a field instance.
field_info_formatter_settings in drupal/core/modules/field/field.info.inc
Returns a field formatter's default settings.

... See full list

File

drupal/core/modules/field/field.info.inc, line 244
Field Info API, providing information about available fields and field types.

Code

function field_info_formatter_types($formatter_type = NULL) {
  if ($formatter_type) {
    return drupal_container()
      ->get('plugin.manager.field.formatter')
      ->getDefinition($formatter_type);
  }
  else {
    return drupal_container()
      ->get('plugin.manager.field.formatter')
      ->getDefinitions();
  }
}