1 file.admin.inc file_info_formatter_types($formatter_type = NULL)

Returns information about file formatters from hook_file_formatter_info().

Parameters

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

Return value

string|array: Either a file formatter description, as provided by hook_file_formatter_info(), or an array of all existing file formatters, keyed by formatter type name.

File

core/modules/file/file.admin.inc, line 650
File type editing user interface.

Code

function file_info_formatter_types($formatter_type = NULL) {
  $info = &backdrop_static(__FUNCTION__);
  if (!isset($info)) {
    $info = module_invoke_all('file_formatter_info');
    backdrop_alter('file_formatter_info', $info);
    uasort($info, '_file_sort_weight_label');
  }
  if ($formatter_type) {
    if (isset($info[$formatter_type])) {
      return $info[$formatter_type];
    }
  }
  else {
    return $info;
  }
}