Returns information about field formatters from hook_field_formatter_info().
string $formatter_type: (optional) A formatter type name. If omitted, all formatter types will be returned.
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.
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();
}
}