You are here

function insert_video_formatters in Insert Video 7

Build a list of available formatters.

2 calls to insert_video_formatters()
insert_video_insert_styles in ./insert_video.module
Implementation of hook_insert_styles().
template_preprocess_video_insert_video in ./insert_video.module
Theme the content that will be inserted for Video.

File

./insert_video.module, line 94
Insert support for Media module.

Code

function insert_video_formatters($key = NULL, $refresh = FALSE) {
  $formatters =& drupal_static(__FUNCTION__, array());

  // Return our cached id if allowed, and it exists.
  if (!$refresh && $key && isset($formatters[$key])) {
    return $formatters[$key];
  }
  elseif (!$refresh && $key && !isset($formatters[$key])) {
    return $formatters;
  }
  $formatters = file_info_formatter_types();
  foreach ($formatters as $name => $formatter) {
    if (!isset($formatter['file types']) || !in_array('video', $formatter['file types'])) {
      unset($formatters[$name]);
    }
  }
  return !isset($formatters[$key]) ? $formatters : $formatters[$key];
}