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

4 calls to field_info_formatter_types()
EditorSelector::getEditor in drupal/core/modules/edit/lib/Drupal/edit/EditorSelector.php
Returns the in-place editor (an Editor plugin) to use for a field.
FieldInfoTest::testSettingsInfo in drupal/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php
Test that the field_info settings convenience functions work.
field_info_formatter_settings in drupal/core/modules/field/field.info.inc
Returns a field formatter's default settings.
ManageDisplayTest::testViewModeCustom in drupal/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php
Tests switching view modes to use custom or 'default' settings'.

File

drupal/core/modules/field/field.info.inc, line 235
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();
  }
}